From 89e9f7189daf847b88b7e0b766ab52d69d546044 Mon Sep 17 00:00:00 2001 From: bmc-msft <41130664+bmc-msft@users.noreply.github.com> Date: Wed, 20 Apr 2022 15:43:51 -0400 Subject: [PATCH] include path and x_ms_path endpoints in genearted crates (#718) This addresses an issue where some specs split endpoints between `path` and `x-ms-path`. This exposes a significant number of operations across the generated crates that were not previously included. NOTE: this was generated using version of the REST specs, 48d85585897aa6ed448ca689b094e60377a25cb7 --- services/autorust/codegen/src/spec.rs | 6 +- services/autorust/openapi/src/openapi.rs | 15 +- services/mgmt/apimanagement/README.md | 18 +- .../src/package_2018_06_preview/operations.rs | 16457 ++++++++---- .../src/package_2019_01/operations.rs | 16667 +++++++++---- .../src/package_2019_12/operations.rs | 19049 ++++++++++---- .../src/package_2020_12/operations.rs | 20031 ++++++++++----- .../src/package_2021_08/operations.rs | 20719 +++++++++++----- .../src/package_preview_2019_12/operations.rs | 17965 ++++++++++---- .../src/package_preview_2020_06/operations.rs | 20031 ++++++++++----- .../src/package_preview_2021_01/operations.rs | 20031 ++++++++++----- .../src/package_preview_2021_04/operations.rs | 20081 ++++++++++----- services/mgmt/authorization/README.md | 14 +- .../package_2018_01_01_preview/operations.rs | 557 + .../operations.rs | 557 + .../package_2018_07_01_preview/operations.rs | 557 + .../package_2018_09_01_preview/operations.rs | 557 + .../package_2020_03_01_preview/operations.rs | 557 + .../package_2020_04_01_preview/operations.rs | 557 + .../package_2020_08_01_preview/operations.rs | 557 + services/mgmt/kusto/README.md | 2 +- .../kusto/src/package_2022_02/operations.rs | 7005 ++++++ services/mgmt/policyinsights/README.md | 12 +- .../src/package_2019_10/operations.rs | 3942 ++- .../src/package_2020_07/operations.rs | 3942 ++- .../src/package_2020_07_preview/operations.rs | 3942 ++- .../src/package_2021_01/operations.rs | 3942 ++- .../src/package_2021_10/operations.rs | 3942 ++- .../src/package_2022_03/operations.rs | 3942 ++- services/mgmt/resources/README.md | 6 +- .../operations.rs | 1374 + .../models.rs | 15 + .../operations.rs | 2029 ++ .../src/package_preview_2020_08/operations.rs | 2040 ++ services/mgmt/vmware/Cargo.toml | 2 +- services/svc/containerregistry/README.md | 2 +- .../src/package_2019_08/operations.rs | 2197 ++ services/svc/cosmosdb/README.md | 2 +- .../src/package_2019_02/operations.rs | 1410 ++ services/svc/datalakeanalytics/README.md | 2 +- .../src/package_catalog_2016_11/operations.rs | 5018 +++- services/svc/deviceupdate/README.md | 4 +- .../src/package_2020_09_01/operations.rs | 2684 ++ .../package_2021_06_01_preview/operations.rs | 3532 +++ services/svc/eventgrid/README.md | 2 +- .../src/package_2018_01/operations.rs | 62 + services/svc/graphrbac/README.md | 2 +- services/svc/graphrbac/src/v1_6/operations.rs | 5047 +++- services/svc/keyvault/Cargo.toml | 1 - services/svc/synapse/README.md | 12 +- .../operations.rs | 494 + .../operations.rs | 494 + .../operations.rs | 494 + .../operations.rs | 494 + .../operations.rs | 494 + .../operations.rs | 494 + 56 files changed, 184683 insertions(+), 49378 deletions(-) diff --git a/services/autorust/codegen/src/spec.rs b/services/autorust/codegen/src/spec.rs index cd2d643dbd..2c1d98e2b0 100644 --- a/services/autorust/codegen/src/spec.rs +++ b/services/autorust/codegen/src/spec.rs @@ -68,7 +68,7 @@ impl Spec { docs.insert(Utf8PathBuf::from(file_path), doc); for ref_file in ref_files { let child_path = io::join(&file_path, &ref_file)?; - Spec::read_file(docs, &child_path)?; + Self::read_file(docs, &child_path)?; } } Ok(()) @@ -239,7 +239,7 @@ impl Spec { let mut operations: Vec = Vec::new(); for (doc_file, doc) in self.docs() { if self.is_input_file(&doc_file) { - let paths = self.resolve_path_map(doc_file, doc.paths())?; + let paths = self.resolve_path_map(doc_file, &doc.paths())?; for (path, item) in &paths { operations.extend(path_operations_unresolved(doc_file, path, item)) } @@ -368,7 +368,7 @@ pub mod openapi { match item { ReferenceOr::Reference { reference, .. } => list.push(TypedReference::PathItem(reference.clone())), ReferenceOr::Item(item) => { - for operation in path_operations_unresolved(&doc_file, path, item) { + for operation in path_operations_unresolved(&doc_file, &path, &item) { // parameters for param in &operation.parameters { match param { diff --git a/services/autorust/openapi/src/openapi.rs b/services/autorust/openapi/src/openapi.rs index 93dbdf27b6..e012a4f9f7 100644 --- a/services/autorust/openapi/src/openapi.rs +++ b/services/autorust/openapi/src/openapi.rs @@ -54,12 +54,17 @@ pub struct OpenAPI { } impl OpenAPI { - pub fn paths(&self) -> &IndexMap> { - if !self.x_ms_paths.is_empty() { - &self.x_ms_paths - } else { - &self.paths + pub fn paths(&self) -> IndexMap> { + let mut result = IndexMap::new(); + for (k, v) in self.x_ms_paths.iter() { + result.insert(k.clone(), v.clone()); } + for (k, v) in self.paths.iter() { + if !self.x_ms_paths.contains_key(k) { + result.insert(k.clone(), v.clone()); + } + } + result } pub fn version(&self) -> Result<&str, Error> { Ok(self.info.version.as_ref().ok_or(Error::MissingApiVersion)?.as_str()) diff --git a/services/mgmt/apimanagement/README.md b/services/mgmt/apimanagement/README.md index b3e4cdead0..f99822d758 100644 --- a/services/mgmt/apimanagement/README.md +++ b/services/mgmt/apimanagement/README.md @@ -10,12 +10,12 @@ The default tag is `package-2021-08`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: -- `package-2021-08` has 271 operations from 1 API versions: `2021-08-01`. Use crate feature `package-2021-08` to enable. The operations will be in the `package_2021_08` module. -- `package-preview-2021-04` has 271 operations from 1 API versions: `2021-04-01-preview`. Use crate feature `package-preview-2021-04` to enable. The operations will be in the `package_preview_2021_04` module. -- `package-preview-2021-01` has 258 operations from 1 API versions: `2021-01-01-preview`. Use crate feature `package-preview-2021-01` to enable. The operations will be in the `package_preview_2021_01` module. -- `package-2020-12` has 258 operations from 1 API versions: `2020-12-01`. Use crate feature `package-2020-12` to enable. The operations will be in the `package_2020_12` module. -- `package-preview-2020-06` has 258 operations from 1 API versions: `2020-06-01-preview`. Use crate feature `package-preview-2020-06` to enable. The operations will be in the `package_preview_2020_06` module. -- `package-2019-12` has 238 operations from 1 API versions: `2019-12-01`. Use crate feature `package-2019-12` to enable. The operations will be in the `package_2019_12` module. -- `package-preview-2019-12` has 228 operations from 1 API versions: `2019-12-01-preview`. Use crate feature `package-preview-2019-12` to enable. The operations will be in the `package_preview_2019_12` module. -- `package-2019-01` has 202 operations from 1 API versions: `2019-01-01`. Use crate feature `package-2019-01` to enable. The operations will be in the `package_2019_01` module. -- `package-2018-06-preview` has 204 operations from 1 API versions: `2018-06-01-preview`. Use crate feature `package-2018-06-preview` to enable. The operations will be in the `package_2018_06_preview` module. \ No newline at end of file +- `package-2021-08` has 344 operations from 1 API versions: `2021-08-01`. Use crate feature `package-2021-08` to enable. The operations will be in the `package_2021_08` module. +- `package-preview-2021-04` has 344 operations from 1 API versions: `2021-04-01-preview`. Use crate feature `package-preview-2021-04` to enable. The operations will be in the `package_preview_2021_04` module. +- `package-preview-2021-01` has 331 operations from 1 API versions: `2021-01-01-preview`. Use crate feature `package-preview-2021-01` to enable. The operations will be in the `package_preview_2021_01` module. +- `package-2020-12` has 331 operations from 1 API versions: `2020-12-01`. Use crate feature `package-2020-12` to enable. The operations will be in the `package_2020_12` module. +- `package-preview-2020-06` has 331 operations from 1 API versions: `2020-06-01-preview`. Use crate feature `package-preview-2020-06` to enable. The operations will be in the `package_preview_2020_06` module. +- `package-2019-12` has 311 operations from 1 API versions: `2019-12-01`. Use crate feature `package-2019-12` to enable. The operations will be in the `package_2019_12` module. +- `package-preview-2019-12` has 301 operations from 1 API versions: `2019-12-01-preview`. Use crate feature `package-preview-2019-12` to enable. The operations will be in the `package_preview_2019_12` module. +- `package-2019-01` has 275 operations from 1 API versions: `2019-01-01`. Use crate feature `package-2019-01` to enable. The operations will be in the `package_2019_01` module. +- `package-2018-06-preview` has 277 operations from 1 API versions: `2018-06-01-preview`. Use crate feature `package-2018-06-preview` to enable. The operations will be in the `package_2018_06_preview` module. \ No newline at end of file diff --git a/services/mgmt/apimanagement/src/package_2018_06_preview/operations.rs b/services/mgmt/apimanagement/src/package_2018_06_preview/operations.rs index fd63af3ab9..7934411c1b 100644 --- a/services/mgmt/apimanagement/src/package_2018_06_preview/operations.rs +++ b/services/mgmt/apimanagement/src/package_2018_06_preview/operations.rs @@ -77,9 +77,21 @@ impl Client { pub fn api(&self) -> api::Client { api::Client(self.clone()) } + pub fn api_diagnostic(&self) -> api_diagnostic::Client { + api_diagnostic::Client(self.clone()) + } pub fn api_export(&self) -> api_export::Client { api_export::Client(self.clone()) } + pub fn api_issue(&self) -> api_issue::Client { + api_issue::Client(self.clone()) + } + pub fn api_issue_attachment(&self) -> api_issue_attachment::Client { + api_issue_attachment::Client(self.clone()) + } + pub fn api_issue_comment(&self) -> api_issue_comment::Client { + api_issue_comment::Client(self.clone()) + } pub fn api_management_operations(&self) -> api_management_operations::Client { api_management_operations::Client(self.clone()) } @@ -89,6 +101,27 @@ impl Client { pub fn api_management_service_skus(&self) -> api_management_service_skus::Client { api_management_service_skus::Client(self.clone()) } + pub fn api_operation(&self) -> api_operation::Client { + api_operation::Client(self.clone()) + } + pub fn api_operation_policy(&self) -> api_operation_policy::Client { + api_operation_policy::Client(self.clone()) + } + pub fn api_policy(&self) -> api_policy::Client { + api_policy::Client(self.clone()) + } + pub fn api_product(&self) -> api_product::Client { + api_product::Client(self.clone()) + } + pub fn api_release(&self) -> api_release::Client { + api_release::Client(self.clone()) + } + pub fn api_revisions(&self) -> api_revisions::Client { + api_revisions::Client(self.clone()) + } + pub fn api_schema(&self) -> api_schema::Client { + api_schema::Client(self.clone()) + } pub fn api_version_set(&self) -> api_version_set::Client { api_version_set::Client(self.clone()) } @@ -143,6 +176,9 @@ impl Client { pub fn open_id_connect_provider(&self) -> open_id_connect_provider::Client { open_id_connect_provider::Client(self.clone()) } + pub fn operation(&self) -> operation::Client { + operation::Client(self.clone()) + } pub fn policy(&self) -> policy::Client { policy::Client(self.clone()) } @@ -191,6 +227,9 @@ impl Client { pub fn tag(&self) -> tag::Client { tag::Client(self.clone()) } + pub fn tag_description(&self) -> tag_description::Client { + tag_description::Client(self.clone()) + } pub fn tag_resource(&self) -> tag_resource::Client { tag_resource::Client(self.clone()) } @@ -226,6 +265,152 @@ pub enum Error { #[error(transparent)] ApiExport_Get(#[from] api_export::get::Error), #[error(transparent)] + Api_ListByService(#[from] api::list_by_service::Error), + #[error(transparent)] + Api_Get(#[from] api::get::Error), + #[error(transparent)] + Api_CreateOrUpdate(#[from] api::create_or_update::Error), + #[error(transparent)] + Api_Update(#[from] api::update::Error), + #[error(transparent)] + Api_Delete(#[from] api::delete::Error), + #[error(transparent)] + Api_GetEntityTag(#[from] api::get_entity_tag::Error), + #[error(transparent)] + ApiRevisions_List(#[from] api_revisions::list::Error), + #[error(transparent)] + ApiRelease_List(#[from] api_release::list::Error), + #[error(transparent)] + ApiRelease_Get(#[from] api_release::get::Error), + #[error(transparent)] + ApiRelease_Create(#[from] api_release::create::Error), + #[error(transparent)] + ApiRelease_Update(#[from] api_release::update::Error), + #[error(transparent)] + ApiRelease_Delete(#[from] api_release::delete::Error), + #[error(transparent)] + ApiRelease_GetEntityTag(#[from] api_release::get_entity_tag::Error), + #[error(transparent)] + ApiOperation_ListByApi(#[from] api_operation::list_by_api::Error), + #[error(transparent)] + ApiOperation_Get(#[from] api_operation::get::Error), + #[error(transparent)] + ApiOperation_CreateOrUpdate(#[from] api_operation::create_or_update::Error), + #[error(transparent)] + ApiOperation_Update(#[from] api_operation::update::Error), + #[error(transparent)] + ApiOperation_Delete(#[from] api_operation::delete::Error), + #[error(transparent)] + ApiOperation_GetEntityTag(#[from] api_operation::get_entity_tag::Error), + #[error(transparent)] + ApiOperationPolicy_ListByOperation(#[from] api_operation_policy::list_by_operation::Error), + #[error(transparent)] + ApiOperationPolicy_Get(#[from] api_operation_policy::get::Error), + #[error(transparent)] + ApiOperationPolicy_CreateOrUpdate(#[from] api_operation_policy::create_or_update::Error), + #[error(transparent)] + ApiOperationPolicy_Delete(#[from] api_operation_policy::delete::Error), + #[error(transparent)] + ApiOperationPolicy_GetEntityTag(#[from] api_operation_policy::get_entity_tag::Error), + #[error(transparent)] + Tag_ListByOperation(#[from] tag::list_by_operation::Error), + #[error(transparent)] + Tag_GetByOperation(#[from] tag::get_by_operation::Error), + #[error(transparent)] + Tag_AssignToOperation(#[from] tag::assign_to_operation::Error), + #[error(transparent)] + Tag_DetachFromOperation(#[from] tag::detach_from_operation::Error), + #[error(transparent)] + Tag_GetEntityStateByOperation(#[from] tag::get_entity_state_by_operation::Error), + #[error(transparent)] + ApiProduct_ListByApis(#[from] api_product::list_by_apis::Error), + #[error(transparent)] + ApiPolicy_ListByApi(#[from] api_policy::list_by_api::Error), + #[error(transparent)] + ApiPolicy_Get(#[from] api_policy::get::Error), + #[error(transparent)] + ApiPolicy_CreateOrUpdate(#[from] api_policy::create_or_update::Error), + #[error(transparent)] + ApiPolicy_Delete(#[from] api_policy::delete::Error), + #[error(transparent)] + ApiPolicy_GetEntityTag(#[from] api_policy::get_entity_tag::Error), + #[error(transparent)] + ApiSchema_ListByApi(#[from] api_schema::list_by_api::Error), + #[error(transparent)] + ApiSchema_Get(#[from] api_schema::get::Error), + #[error(transparent)] + ApiSchema_CreateOrUpdate(#[from] api_schema::create_or_update::Error), + #[error(transparent)] + ApiSchema_Delete(#[from] api_schema::delete::Error), + #[error(transparent)] + ApiSchema_GetEntityTag(#[from] api_schema::get_entity_tag::Error), + #[error(transparent)] + ApiDiagnostic_ListByService(#[from] api_diagnostic::list_by_service::Error), + #[error(transparent)] + ApiDiagnostic_Get(#[from] api_diagnostic::get::Error), + #[error(transparent)] + ApiDiagnostic_CreateOrUpdate(#[from] api_diagnostic::create_or_update::Error), + #[error(transparent)] + ApiDiagnostic_Update(#[from] api_diagnostic::update::Error), + #[error(transparent)] + ApiDiagnostic_Delete(#[from] api_diagnostic::delete::Error), + #[error(transparent)] + ApiDiagnostic_GetEntityTag(#[from] api_diagnostic::get_entity_tag::Error), + #[error(transparent)] + ApiIssue_ListByService(#[from] api_issue::list_by_service::Error), + #[error(transparent)] + ApiIssue_Get(#[from] api_issue::get::Error), + #[error(transparent)] + ApiIssue_CreateOrUpdate(#[from] api_issue::create_or_update::Error), + #[error(transparent)] + ApiIssue_Update(#[from] api_issue::update::Error), + #[error(transparent)] + ApiIssue_Delete(#[from] api_issue::delete::Error), + #[error(transparent)] + ApiIssue_GetEntityTag(#[from] api_issue::get_entity_tag::Error), + #[error(transparent)] + ApiIssueComment_ListByService(#[from] api_issue_comment::list_by_service::Error), + #[error(transparent)] + ApiIssueComment_Get(#[from] api_issue_comment::get::Error), + #[error(transparent)] + ApiIssueComment_CreateOrUpdate(#[from] api_issue_comment::create_or_update::Error), + #[error(transparent)] + ApiIssueComment_Delete(#[from] api_issue_comment::delete::Error), + #[error(transparent)] + ApiIssueComment_GetEntityTag(#[from] api_issue_comment::get_entity_tag::Error), + #[error(transparent)] + ApiIssueAttachment_ListByService(#[from] api_issue_attachment::list_by_service::Error), + #[error(transparent)] + ApiIssueAttachment_Get(#[from] api_issue_attachment::get::Error), + #[error(transparent)] + ApiIssueAttachment_CreateOrUpdate(#[from] api_issue_attachment::create_or_update::Error), + #[error(transparent)] + ApiIssueAttachment_Delete(#[from] api_issue_attachment::delete::Error), + #[error(transparent)] + ApiIssueAttachment_GetEntityTag(#[from] api_issue_attachment::get_entity_tag::Error), + #[error(transparent)] + TagDescription_ListByApi(#[from] tag_description::list_by_api::Error), + #[error(transparent)] + TagDescription_Get(#[from] tag_description::get::Error), + #[error(transparent)] + TagDescription_CreateOrUpdate(#[from] tag_description::create_or_update::Error), + #[error(transparent)] + TagDescription_Delete(#[from] tag_description::delete::Error), + #[error(transparent)] + TagDescription_GetEntityState(#[from] tag_description::get_entity_state::Error), + #[error(transparent)] + Tag_ListByApi(#[from] tag::list_by_api::Error), + #[error(transparent)] + Tag_GetByApi(#[from] tag::get_by_api::Error), + #[error(transparent)] + Tag_AssignToApi(#[from] tag::assign_to_api::Error), + #[error(transparent)] + Tag_DetachFromApi(#[from] tag::detach_from_api::Error), + #[error(transparent)] + Tag_GetEntityStateByApi(#[from] tag::get_entity_state_by_api::Error), + #[error(transparent)] + Operation_ListByTags(#[from] operation::list_by_tags::Error), + #[error(transparent)] Api_ListByTags(#[from] api::list_by_tags::Error), #[error(transparent)] AuthorizationServer_ListByService(#[from] authorization_server::list_by_service::Error), @@ -746,6 +931,109 @@ pub mod api { use super::models; 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, + tags: None, + expand_api_version_set: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + delete_revisions: None, + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } pub fn list_by_tags( &self, resource_group_name: impl Into, @@ -764,7 +1052,7 @@ pub mod api { } } } - pub mod list_by_tags { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -797,7 +1085,8 @@ pub mod api { pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, - pub(crate) include_not_tagged_apis: Option, + pub(crate) tags: Option, + pub(crate) expand_api_version_set: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -812,14 +1101,18 @@ pub mod api { self.skip = Some(skip); self } - pub fn include_not_tagged_apis(mut self, include_not_tagged_apis: bool) -> Self { - self.include_not_tagged_apis = Some(include_not_tagged_apis); + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.into()); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn expand_api_version_set(mut self, expand_api_version_set: bool) -> Self { + self.expand_api_version_set = Some(expand_api_version_set); + 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/{}/apisByTags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -844,9 +1137,12 @@ pub mod api { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } - if let Some(include_not_tagged_apis) = &self.include_not_tagged_apis { + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } + if let Some(expand_api_version_set) = &self.expand_api_version_set { url.query_pairs_mut() - .append_pair("includeNotTaggedApis", &include_not_tagged_apis.to_string()); + .append_pair("expandApiVersionSet", &expand_api_version_set.to_string()); } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); @@ -856,7 +1152,7 @@ pub mod api { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagResourceCollection = + let rsp_value: models::ApiCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -874,259 +1170,48 @@ pub mod api { } } } -} -pub mod authorization_server { - use super::models; - 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, - authsid: 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(), - authsid: authsid.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: 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(), - authsid: authsid.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - authsid: authsid.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: 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(), - authsid: authsid.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, - authsid: 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(), - authsid: authsid.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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/{}/authorizationServers", - 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", "2018-06-01-preview"); - 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::AuthorizationServerCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: String, + pub(crate) api_id: String, 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.ApiManagement/service/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1146,7 +1231,7 @@ pub mod authorization_server { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1168,8 +1253,9 @@ pub mod authorization_server { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::AuthorizationServerContract), - Ok200(models::AuthorizationServerContract), + Created201(models::ApiContract), + Accepted202, + Ok200(models::ApiContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1198,8 +1284,8 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, - pub(crate) parameters: models::AuthorizationServerContract, + pub(crate) api_id: String, + pub(crate) parameters: models::ApiCreateOrUpdateParameter, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -1211,12 +1297,12 @@ pub mod authorization_server { 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1240,13 +1326,14 @@ pub mod authorization_server { 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::AuthorizationServerContract = + let rsp_value: models::ApiContract = 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), http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -1293,8 +1380,8 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, - pub(crate) parameters: models::AuthorizationServerUpdateContract, + pub(crate) api_id: String, + pub(crate) parameters: models::ApiUpdateContract, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -1302,12 +1389,12 @@ pub mod authorization_server { 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1376,20 +1463,25 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, + pub(crate) api_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) delete_revisions: Option, } impl Builder { + pub fn delete_revisions(mut self, delete_revisions: bool) -> Self { + self.delete_revisions = Some(delete_revisions); + 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1401,6 +1493,9 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); + if let Some(delete_revisions) = &self.delete_revisions { + url.query_pairs_mut().append_pair("deleteRevisions", &delete_revisions.to_string()); + } 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()); @@ -1453,19 +1548,19 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, + pub(crate) api_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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1498,129 +1593,7 @@ pub mod authorization_server { } } } -} -pub mod backend { - use super::models; - 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, - backend_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(), - backend_id: backend_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - backend_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(), - backend_id: backend_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - backend_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - backend_id: backend_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - backend_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(), - backend_id: backend_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, - backend_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(), - backend_id: backend_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn reconnect( - &self, - resource_group_name: impl Into, - service_name: impl Into, - backend_id: impl Into, - subscription_id: impl Into, - ) -> reconnect::Builder { - reconnect::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - backend_id: backend_id.into(), - subscription_id: subscription_id.into(), - parameters: None, - } - } - } - pub mod list_by_service { + pub mod list_by_tags { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1653,6 +1626,7 @@ pub mod backend { pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, + pub(crate) include_not_tagged_apis: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -1667,10 +1641,14 @@ pub mod backend { self.skip = Some(skip); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn include_not_tagged_apis(mut self, include_not_tagged_apis: bool) -> Self { + self.include_not_tagged_apis = Some(include_not_tagged_apis); + 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/{}/backends", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apisByTags", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -1695,6 +1673,10 @@ pub mod backend { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } + if let Some(include_not_tagged_apis) = &self.include_not_tagged_apis { + url.query_pairs_mut() + .append_pair("includeNotTaggedApis", &include_not_tagged_apis.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)?; @@ -1703,7 +1685,7 @@ pub mod backend { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackendCollection = + let rsp_value: models::TagResourceCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1721,7 +1703,31 @@ pub mod backend { } } } - pub mod get { +} +pub mod api_revisions { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1750,19 +1756,34 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, + pub(crate) api_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/revisions", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1774,6 +1795,15 @@ pub mod backend { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); + 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)?; @@ -1782,7 +1812,7 @@ pub mod backend { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackendContract = + let rsp_value: models::ApiRevisionCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1800,63 +1830,185 @@ pub mod backend { } } } - pub mod create_or_update { - use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::BackendContract), - Ok200(models::BackendContract), +} +pub mod api_release { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } } - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_id.into(), + subscription_id: subscription_id.into(), + } } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) backend_id: String, - pub(crate) parameters: models::BackendContract, + pub fn create( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + release_id: release_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + release_id: release_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_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, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + 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> { + 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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -1864,27 +2016,26 @@ pub mod backend { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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); + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackendContract = - 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::BackendContract = + let rsp_value: models::ApiReleaseCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -1900,7 +2051,7 @@ pub mod backend { } } } - pub mod update { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1929,25 +2080,25 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, - pub(crate) parameters: models::BackendUpdateParameters, - pub(crate) if_match: String, + pub(crate) api_id: String, + pub(crate) release_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -1955,15 +2106,18 @@ pub mod backend { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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.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::NO_CONTENT => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiReleaseContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -1978,12 +2132,12 @@ pub mod backend { } } } - pub mod delete { + pub mod create { use super::models; #[derive(Debug)] pub enum Response { - Ok200, - NoContent204, + Created201(models::ApiReleaseContract), + Ok200(models::ApiReleaseContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2012,24 +2166,31 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, - pub(crate) if_match: String, + pub(crate) api_id: String, + pub(crate) release_id: String, + pub(crate) parameters: models::ApiReleaseContract, 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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2037,15 +2198,28 @@ pub mod backend { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - req_builder = req_builder.header("If-Match", &self.if_match); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiReleaseContract = + 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::ApiReleaseContract = + 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 = @@ -2060,7 +2234,7 @@ pub mod backend { } } } - pub mod get_entity_tag { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2089,23 +2263,27 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, + pub(crate) api_id: String, + pub(crate) release_id: String, + pub(crate) parameters: models::ApiReleaseContract, + pub(crate) if_match: 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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2113,13 +2291,15 @@ pub mod backend { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => Ok(()), + 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::ErrorResponse = @@ -2134,8 +2314,13 @@ pub mod backend { } } } - pub mod reconnect { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -2163,28 +2348,26 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, + pub(crate) api_id: String, + pub(crate) release_id: String, + pub(crate) if_match: 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<(), Error>> { + 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/{}/backends/{}/reconnect", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2192,18 +2375,15 @@ pub mod backend { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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.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::ACCEPTED => Ok(()), + 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 = @@ -2218,38 +2398,120 @@ pub mod backend { } } } -} -pub mod cache { - use super::models; - 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 { + pub mod get_entity_tag { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) release_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/{}/apis/{}/releases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.release_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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_operation { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), + filter: None, top: None, skip: None, + tags: None, } } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, + api_id: impl Into, + operation_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(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), } } @@ -2257,15 +2519,17 @@ pub mod cache { &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_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(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -2275,8 +2539,9 @@ pub mod cache { &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -2284,7 +2549,8 @@ pub mod cache { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), @@ -2294,7 +2560,8 @@ pub mod cache { &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, + api_id: impl Into, + operation_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -2302,7 +2569,8 @@ pub mod cache { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -2311,19 +2579,21 @@ pub mod cache { &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, + api_id: impl Into, + operation_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(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_service { + pub mod list_by_api { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2352,11 +2622,18 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) api_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, + pub(crate) tags: 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 @@ -2365,14 +2642,19 @@ pub mod cache { self.skip = Some(skip); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.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/{}/caches", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2384,12 +2666,18 @@ pub mod cache { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); + 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()); } + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -2398,7 +2686,7 @@ pub mod cache { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CacheCollection = + let rsp_value: models::OperationCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2445,19 +2733,21 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, 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.ApiManagement/service/{}/caches/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.cache_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2477,7 +2767,7 @@ pub mod cache { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CacheContract = + let rsp_value: models::OperationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2499,8 +2789,8 @@ pub mod cache { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::CacheContract), - Ok200(models::CacheContract), + Created201(models::OperationContract), + Ok200(models::OperationContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2529,8 +2819,9 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, - pub(crate) parameters: models::CacheContract, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) parameters: models::OperationContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -2542,12 +2833,13 @@ pub mod cache { 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/{}/caches/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.cache_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2571,13 +2863,13 @@ pub mod cache { 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::CacheContract = + let rsp_value: models::OperationContract = 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::CacheContract = + let rsp_value: models::OperationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -2624,8 +2916,9 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, - pub(crate) parameters: models::CacheUpdateParameters, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) parameters: models::OperationUpdateContract, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -2633,12 +2926,13 @@ pub mod cache { 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/{}/caches/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.cache_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2707,7 +3001,8 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -2715,12 +3010,13 @@ pub mod cache { 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/{}/caches/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.cache_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2784,19 +3080,21 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, + pub(crate) api_id: String, + pub(crate) operation_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/{}/caches/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.cache_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2830,38 +3128,43 @@ pub mod cache { } } } -pub mod certificate { +pub mod api_operation_policy { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_service( + pub fn list_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> list_by_operation::Builder { + list_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.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, - certificate_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_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(), - certificate_id: certificate_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), } } @@ -2869,15 +3172,19 @@ pub mod certificate { &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_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(), - certificate_id: certificate_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -2887,7 +3194,9 @@ pub mod certificate { &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -2895,7 +3204,9 @@ pub mod certificate { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -2904,19 +3215,23 @@ pub mod certificate { &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_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(), - certificate_id: certificate_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_service { + pub mod list_by_operation { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2945,32 +3260,21 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) operation_id: 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> { + 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/{}/certificates", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2982,15 +3286,6 @@ pub mod certificate { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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)?; @@ -2999,7 +3294,7 @@ pub mod certificate { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CertificateCollection = + let rsp_value: models::PolicyCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -3046,20 +3341,15 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_id: String, 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.ApiManagement/service/{}/certificates/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.certificate_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3078,7 +3368,7 @@ pub mod certificate { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CertificateContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -3100,8 +3390,8 @@ pub mod certificate { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::CertificateContract), - Ok200(models::CertificateContract), + Created201(models::PolicyContract), + Ok200(models::PolicyContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3130,8 +3420,10 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, - pub(crate) parameters: models::CertificateCreateOrUpdateParameters, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -3142,14 +3434,7 @@ pub mod certificate { } 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/{}/certificates/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.certificate_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3172,13 +3457,13 @@ pub mod certificate { 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::CertificateContract = + let rsp_value: models::PolicyContract = 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::CertificateContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -3230,21 +3515,16 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_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/{}/certificates/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.certificate_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3307,20 +3587,15 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_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/{}/certificates/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.certificate_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3353,357 +3628,389 @@ pub mod certificate { } } } -pub mod api_management_operations { - use super::models; - 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; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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.ApiManagement/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", "2018-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match 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 api_management_service_skus { +pub mod tag { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - #[doc = "Gets available SKUs for API Management service"] - pub fn list_available_service_skus( + pub fn list_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, subscription_id: impl Into, - ) -> list_available_service_skus::Builder { - list_available_service_skus::Builder { + ) -> list_by_operation::Builder { + list_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, } } - } - pub mod list_available_service_skus { - use super::models; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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, - } - impl Builder { - 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/{}/skus", - 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", "2018-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ResourceSkuResults = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, - }) - } - } - }) - } - } - } -} -pub mod api_management_service { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn restore( + pub fn get_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> restore::Builder { - restore::Builder { + ) -> get_by_operation::Builder { + get_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - parameters: parameters.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), } } - pub fn backup( + pub fn assign_to_operation( &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> backup::Builder { - backup::Builder { + ) -> assign_to_operation::Builder { + assign_to_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - parameters: parameters.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), } } - pub fn get( + pub fn detach_from_operation( &self, resource_group_name: impl Into, service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> get::Builder { - get::Builder { + ) -> detach_from_operation::Builder { + detach_from_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), } } - pub fn create_or_update( + pub fn get_entity_state_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> create_or_update::Builder { - create_or_update::Builder { + ) -> get_entity_state_by_operation::Builder { + get_entity_state_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - parameters: parameters.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), } } - pub fn update( + pub fn list_by_api( &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + api_id: impl Into, subscription_id: impl Into, - ) -> update::Builder { - update::Builder { + ) -> list_by_api::Builder { + list_by_api::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - parameters: parameters.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, } } - pub fn delete( + pub fn get_by_api( &self, resource_group_name: impl Into, service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> delete::Builder { - delete::Builder { + ) -> get_by_api::Builder { + get_by_api::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), } } - pub fn list_by_resource_group( + pub fn assign_to_api( &self, resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> list_by_resource_group::Builder { - list_by_resource_group::Builder { + ) -> assign_to_api::Builder { + assign_to_api::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), } } - pub fn list(&self, subscription_id: impl Into) -> list::Builder { - list::Builder { + pub fn detach_from_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> detach_from_api::Builder { + detach_from_api::Builder { client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), } } - pub fn get_sso_token( + pub fn get_entity_state_by_api( &self, resource_group_name: impl Into, service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> get_sso_token::Builder { - get_sso_token::Builder { + ) -> get_entity_state_by_api::Builder { + get_entity_state_by_api::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), } } - pub fn check_name_availability( + pub fn list_by_product( &self, - parameters: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, subscription_id: impl Into, - ) -> check_name_availability::Builder { - check_name_availability::Builder { + ) -> list_by_product::Builder { + list_by_product::Builder { client: self.0.clone(), - parameters: parameters.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, } } - pub fn apply_network_configuration_updates( + pub fn get_by_product( &self, resource_group_name: impl Into, service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> apply_network_configuration_updates::Builder { - apply_network_configuration_updates::Builder { + ) -> get_by_product::Builder { + get_by_product::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), - parameters: None, } } - pub fn upload_certificate( + pub fn assign_to_product( &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + product_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> upload_certificate::Builder { - upload_certificate::Builder { + ) -> assign_to_product::Builder { + assign_to_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn detach_from_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> detach_from_product::Builder { + detach_from_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state_by_product::Builder { + get_entity_state_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + 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, + scope: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_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(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_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(), + tag_id: tag_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), + if_match: None, } } - pub fn update_hostname( + pub fn update( &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + tag_id: impl Into, + parameters: impl Into, + if_match: impl Into, subscription_id: impl Into, - ) -> update_hostname::Builder { - update_hostname::Builder { + ) -> update::Builder { + update::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + tag_id: tag_id.into(), parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_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(), + tag_id: tag_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state::Builder { + get_entity_state::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), } } } - pub mod restore { + pub mod list_by_operation { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, - } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -3724,22 +4031,40 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, + pub(crate) api_id: String, + pub(crate) operation_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/restore", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/tags", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.api_id, + &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::POST); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -3747,8 +4072,16 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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(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)?; @@ -3756,16 +4089,17 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = + let rsp_value: models::TagCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(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 { + 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, - body: rsp_body, + value: rsp_value, }) } } @@ -3773,17 +4107,15 @@ pub mod api_management_service { } } } - pub mod backup { + pub mod get_by_operation { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, - } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -3804,22 +4136,27 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_id: String, 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.ApiManagement/service/{}/backup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/tags/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -3827,8 +4164,7 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -3836,16 +4172,17 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = + let rsp_value: models::TagContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(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 { + 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, - body: rsp_body, + value: rsp_value, }) } } @@ -3853,12 +4190,20 @@ pub mod api_management_service { } } } - pub mod get { + pub mod assign_to_operation { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -3879,23 +4224,27 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_id: String, 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.ApiManagement/service/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/tags/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -3909,17 +4258,25 @@ pub mod api_management_service { let 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::TagContract = + 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::ApiManagementServiceResource = + let rsp_value: models::TagContract = 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)?; - Err(Error::UnexpectedResponse { + 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, - body: rsp_body, + value: rsp_value, }) } } @@ -3927,18 +4284,20 @@ pub mod api_management_service { } } } - pub mod create_or_update { + pub mod detach_from_operation { use super::models; #[derive(Debug)] pub enum Response { - Ok200(models::ApiManagementServiceResource), - Created201(models::ApiManagementServiceResource), - Accepted202(models::ApiManagementServiceResource), + 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("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -3959,22 +4318,27 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceResource, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/tags/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -3982,36 +4346,21 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = - 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::ApiManagementServiceResource = - 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::ApiManagementServiceResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Accepted202(rsp_value)) - } + 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 { + 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, - body: rsp_body, + value: rsp_value, }) } } @@ -4019,17 +4368,15 @@ pub mod api_management_service { } } } - pub mod update { + pub mod get_entity_state_by_operation { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, - } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -4050,22 +4397,27 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceUpdateParameters, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/tags/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4073,25 +4425,20 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = - 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::OK => Ok(()), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { + 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, - body: rsp_body, + value: rsp_value, }) } } @@ -4099,18 +4446,15 @@ pub mod api_management_service { } } } - pub mod delete { + pub mod list_by_api { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202(models::ApiManagementServiceResource), - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -4131,21 +4475,38 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) api_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/tags", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.api_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4153,25 +4514,34 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); + 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 => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = + let rsp_value: models::TagCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Accepted202(rsp_value)) + Ok(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)?; - Err(Error::UnexpectedResponse { + 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, - body: rsp_body, + value: rsp_value, }) } } @@ -4179,12 +4549,15 @@ pub mod api_management_service { } } } - pub mod list_by_resource_group { + pub mod get_by_api { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -4204,18 +4577,22 @@ pub mod api_management_service { pub struct Builder { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) tag_id: String, 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.ApiManagement/service", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/tags/{}", self.client.endpoint(), &self.subscription_id, - &self.resource_group_name + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -4235,15 +4612,17 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceListResult = + let rsp_value: models::TagContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { - status_code, - body: rsp_body, + 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, }) } } @@ -4251,12 +4630,20 @@ pub mod api_management_service { } } } - pub mod list { + pub mod assign_to_api { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -4275,21 +4662,27 @@ pub mod api_management_service { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) tag_id: String, 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.ApiManagement/service", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/tags/{}", self.client.endpoint(), - &self.subscription_id + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4303,17 +4696,25 @@ pub mod api_management_service { let 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::TagContract = + 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::ApiManagementServiceListResult = + let rsp_value: models::TagContract = 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)?; - Err(Error::UnexpectedResponse { + 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, - body: rsp_body, + value: rsp_value, }) } } @@ -4321,12 +4722,20 @@ pub mod api_management_service { } } } - pub mod get_sso_token { + pub mod detach_from_api { use super::models; + #[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("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -4347,24 +4756,25 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) tag_id: String, 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.ApiManagement/service/{}/getssotoken", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/tags/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.api_id, + &self.tag_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4373,23 +4783,20 @@ pub mod api_management_service { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); 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::ApiManagementServiceGetSsoTokenResult = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 { + 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, - body: rsp_body, + value: rsp_value, }) } } @@ -4397,12 +4804,15 @@ pub mod api_management_service { } } } - pub mod check_name_availability { + pub mod get_entity_state_by_api { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -4421,23 +4831,27 @@ pub mod api_management_service { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) parameters: models::ApiManagementServiceCheckNameAvailabilityParameters, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) tag_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.ApiManagement/checkNameAvailability", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/tags/{}", self.client.endpoint(), - &self.subscription_id + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4445,24 +4859,20 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceNameAvailabilityResult = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + http::StatusCode::OK => Ok(()), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { + 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, - body: rsp_body, + value: rsp_value, }) } } @@ -4470,17 +4880,15 @@ pub mod api_management_service { } } } - pub mod apply_network_configuration_updates { + pub mod list_by_product { use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Ok200(models::ApiManagementServiceResource), - } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -4501,20 +4909,38 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) product_id: String, pub(crate) subscription_id: String, - pub(crate) parameters: Option, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn parameters(mut self, parameters: impl Into) -> Self { - self.parameters = Some(parameters.into()); + 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> { + 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/{}/applynetworkconfigurationupdates" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4522,29 +4948,34 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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 - }; + 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::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::ApiManagementServiceResource = + let rsp_value: models::TagCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { + 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, - body: rsp_body, + value: rsp_value, }) } } @@ -4552,12 +4983,15 @@ pub mod api_management_service { } } } - pub mod upload_certificate { + pub mod get_by_product { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -4578,22 +5012,25 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceUploadCertificateParameters, + pub(crate) product_id: String, + pub(crate) tag_id: String, 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.ApiManagement/service/{}/updatecertificate", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/tags/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.product_id, + &self.tag_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4601,8 +5038,7 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -4610,15 +5046,17 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CertificateInformation = + let rsp_value: models::TagContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { + 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, - body: rsp_body, + value: rsp_value, }) } } @@ -4626,17 +5064,20 @@ pub mod api_management_service { } } } - pub mod update_hostname { + pub mod assign_to_product { use super::models; #[derive(Debug)] pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202(models::ApiManagementServiceResource), + Created201(models::TagContract), + Ok200(models::TagContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -4657,22 +5098,25 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceUpdateHostnameParameters, + pub(crate) product_id: String, + pub(crate) tag_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/{}/updatehostname", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/tags/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.product_id, + &self.tag_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4680,30 +5124,31 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { + http::StatusCode::CREATED => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = + let rsp_value: models::TagContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(Response::Created201(rsp_value)) } - http::StatusCode::ACCEPTED => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = + let rsp_value: models::TagContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Accepted202(rsp_value)) + Ok(Response::Ok200(rsp_value)) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { + 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, - body: rsp_body, + value: rsp_value, }) } } @@ -4711,114 +5156,13 @@ pub mod api_management_service { } } } -} -pub mod diagnostic { - use super::models; - 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, - diagnostic_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(), - diagnostic_id: diagnostic_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - diagnostic_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(), - diagnostic_id: diagnostic_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - diagnostic_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - diagnostic_id: diagnostic_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - diagnostic_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(), - diagnostic_id: diagnostic_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, - diagnostic_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(), - diagnostic_id: diagnostic_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod detach_from_product { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -4846,36 +5190,25 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) tag_id: 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> { + 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/{}/diagnostics", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/tags/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.product_id, + &self.tag_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4883,27 +5216,14 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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::DiagnosticCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -4918,7 +5238,7 @@ pub mod diagnostic { } } } - pub mod get { + pub mod get_entity_state_by_product { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4947,23 +5267,25 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, + pub(crate) product_id: String, + pub(crate) tag_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/tags/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.diagnostic_id + &self.product_id, + &self.tag_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4977,12 +5299,7 @@ pub mod diagnostic { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DiagnosticContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -4997,13 +5314,8 @@ pub mod diagnostic { } } } - pub mod create_or_update { + pub mod list_by_service { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::DiagnosticContract), - Ok200(models::DiagnosticContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -5031,29 +5343,41 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, - pub(crate) parameters: models::DiagnosticContract, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) scope: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + 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> { + 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 scope(mut self, scope: impl Into) -> Self { + self.scope = Some(scope.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/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/tags", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5061,25 +5385,206 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); } - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let 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 => { + 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()); + } + if let Some(scope) = &self.scope { + url.query_pairs_mut().append_pair("scope", scope); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DiagnosticContract = + let rsp_value: models::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_id: String, + pub(crate) parameters: models::TagCreateUpdateParameters, + 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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2018-06-01-preview"); + 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::TagContract = 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::DiagnosticContract = + let rsp_value: models::TagContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -5126,8 +5631,8 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, - pub(crate) parameters: models::DiagnosticContract, + pub(crate) tag_id: String, + pub(crate) parameters: models::TagCreateUpdateParameters, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -5135,12 +5640,12 @@ pub mod diagnostic { 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/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/tags/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.diagnostic_id + &self.tag_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -5209,7 +5714,7 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, + pub(crate) tag_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -5217,12 +5722,12 @@ pub mod diagnostic { 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/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/tags/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.diagnostic_id + &self.tag_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -5257,7 +5762,7 @@ pub mod diagnostic { } } } - pub mod get_entity_tag { + pub mod get_entity_state { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5286,19 +5791,19 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, + pub(crate) tag_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/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/tags/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.diagnostic_id + &self.tag_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -5332,81 +5837,195 @@ pub mod diagnostic { } } } -pub mod email_template { +pub mod api_product { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_service( + pub fn list_by_apis( &self, resource_group_name: impl Into, service_name: impl Into, + api_id: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> list_by_apis::Builder { + list_by_apis::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.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, - template_name: 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(), - template_name: template_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - template_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(), - service_name: service_name.into(), - template_name: template_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, + } + pub mod list_by_apis { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/products", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2018-06-01-preview"); + 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::ProductCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 api_policy { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, resource_group_name: impl Into, service_name: impl Into, - template_name: impl Into, - parameters: impl Into, + api_id: impl Into, subscription_id: impl Into, - ) -> update::Builder { - update::Builder { + ) -> list_by_api::Builder { + list_by_api::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - template_name: template_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_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, - template_name: impl Into, + api_id: impl Into, + policy_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -5414,7 +6033,8 @@ pub mod email_template { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - template_name: template_name.into(), + api_id: api_id.into(), + policy_id: policy_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -5423,27 +6043,7052 @@ pub mod email_template { &self, resource_group_name: impl Into, service_name: impl Into, - template_name: impl Into, + api_id: impl Into, + policy_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(), - template_name: template_name.into(), + api_id: api_id.into(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_service { + pub mod list_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_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/{}/apis/{}/policies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match 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)?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, + 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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2018-06-01-preview"); + 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::PolicyContract = + 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::PolicyContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2018-06-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_schema { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.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, + api_id: 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(), + api_id: api_id.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, + api_id: 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(), + api_id: api_id.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, + api_id: 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(), + api_id: api_id.into(), + schema_id: schema_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + force: None, + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + schema_id: schema_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/schemas", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2018-06-01-preview"); + 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::SchemaCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SchemaContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::SchemaContract), + Ok200(models::SchemaContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) schema_id: String, + pub(crate) parameters: models::SchemaContract, + 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2018-06-01-preview"); + 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::SchemaContract = + 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::SchemaContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) schema_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + pub(crate) force: Option, + } + impl Builder { + pub fn force(mut self, force: bool) -> Self { + self.force = Some(force); + 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2018-06-01-preview"); + if let Some(force) = &self.force { + url.query_pairs_mut().append_pair("force", &force.to_string()); + } + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_diagnostic { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.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, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_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, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/diagnostics", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2018-06-01-preview"); + 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::DiagnosticCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::DiagnosticContract), + Ok200(models::DiagnosticContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + 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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2018-06-01-preview"); + 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::DiagnosticContract = + 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::DiagnosticContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + pub(crate) if_match: 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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2018-06-01-preview"); + 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.header("If-Match", &self.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::NO_CONTENT => 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2018-06-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_issue { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + expand_comments_attachments: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + expand_comments_attachments: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + issue_id: issue_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_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, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) expand_comments_attachments: 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 expand_comments_attachments(mut self, expand_comments_attachments: bool) -> Self { + self.expand_comments_attachments = Some(expand_comments_attachments); + 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/{}/apis/{}/issues", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2018-06-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(expand_comments_attachments) = &self.expand_comments_attachments { + url.query_pairs_mut() + .append_pair("expandCommentsAttachments", &expand_comments_attachments.to_string()); + } + 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::IssueCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) subscription_id: String, + pub(crate) expand_comments_attachments: Option, + } + impl Builder { + pub fn expand_comments_attachments(mut self, expand_comments_attachments: bool) -> Self { + self.expand_comments_attachments = Some(expand_comments_attachments); + 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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2018-06-01-preview"); + if let Some(expand_comments_attachments) = &self.expand_comments_attachments { + url.query_pairs_mut() + .append_pair("expandCommentsAttachments", &expand_comments_attachments.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::IssueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueContract), + Ok200(models::IssueContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) parameters: models::IssueContract, + 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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2018-06-01-preview"); + 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::IssueContract = + 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::IssueContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) parameters: models::IssueUpdateContract, + pub(crate) if_match: 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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2018-06-01-preview"); + 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.header("If-Match", &self.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::NO_CONTENT => 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2018-06-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_issue_comment { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: 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(), + api_id: api_id.into(), + issue_id: issue_id.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, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_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, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_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, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: 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/{}/apis/{}/issues/{}/comments", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2018-06-01-preview"); + 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::IssueCommentCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueCommentContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueCommentContract), + Ok200(models::IssueCommentContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_id: String, + pub(crate) parameters: models::IssueCommentContract, + 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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2018-06-01-preview"); + 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::IssueCommentContract = + 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::IssueCommentContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2018-06-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_issue_attachment { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: 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(), + api_id: api_id.into(), + issue_id: issue_id.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, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_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, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_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, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: 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/{}/apis/{}/issues/{}/attachments", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2018-06-01-preview"); + 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::IssueAttachmentCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueAttachmentContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueAttachmentContract), + Ok200(models::IssueAttachmentContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_id: String, + pub(crate) parameters: models::IssueAttachmentContract, + 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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2018-06-01-preview"); + 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::IssueAttachmentContract = + 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::IssueAttachmentContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2018-06-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 tag_description { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.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, + api_id: impl Into, + tag_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(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_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(), + api_id: api_id.into(), + tag_id: tag_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, + api_id: impl Into, + tag_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(), + api_id: api_id.into(), + tag_id: tag_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state::Builder { + get_entity_state::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/tagDescriptions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2018-06-01-preview"); + 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::TagDescriptionCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagDescriptionContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::TagDescriptionContract), + Ok200(models::TagDescriptionContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_id: String, + pub(crate) parameters: models::TagDescriptionCreateParameters, + 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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2018-06-01-preview"); + 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::TagDescriptionContract = + 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::TagDescriptionContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2018-06-01-preview"); + 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_state { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 operation { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_tags( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_tags::Builder { + list_by_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + include_not_tagged_operations: None, + } + } + } + pub mod list_by_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) include_not_tagged_operations: 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 include_not_tagged_operations(mut self, include_not_tagged_operations: bool) -> Self { + self.include_not_tagged_operations = Some(include_not_tagged_operations); + 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/{}/apis/{}/operationsByTags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2018-06-01-preview"); + 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()); + } + if let Some(include_not_tagged_operations) = &self.include_not_tagged_operations { + url.query_pairs_mut() + .append_pair("includeNotTaggedOperations", &include_not_tagged_operations.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::TagResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod authorization_server { + use super::models; + 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, + authsid: 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(), + authsid: authsid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: 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(), + authsid: authsid.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + authsid: authsid.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: 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(), + authsid: authsid.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, + authsid: 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(), + authsid: authsid.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/authorizationServers", + 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", "2018-06-01-preview"); + 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::AuthorizationServerCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationServerContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::AuthorizationServerContract), + Ok200(models::AuthorizationServerContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: String, + pub(crate) parameters: models::AuthorizationServerContract, + 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2018-06-01-preview"); + 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::AuthorizationServerContract = + 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::AuthorizationServerContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: String, + pub(crate) parameters: models::AuthorizationServerUpdateContract, + pub(crate) if_match: 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2018-06-01-preview"); + 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.header("If-Match", &self.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::NO_CONTENT => 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2018-06-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 backend { + use super::models; + 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, + backend_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(), + backend_id: backend_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_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(), + backend_id: backend_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + backend_id: backend_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_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(), + backend_id: backend_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, + backend_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(), + backend_id: backend_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn reconnect( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_id: impl Into, + subscription_id: impl Into, + ) -> reconnect::Builder { + reconnect::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + backend_id: backend_id.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/backends", + 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", "2018-06-01-preview"); + 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::BackendCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) backend_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/{}/backends/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.backend_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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackendContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::BackendContract), + Ok200(models::BackendContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) backend_id: String, + pub(crate) parameters: models::BackendContract, + 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/{}/backends/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.backend_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", "2018-06-01-preview"); + 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::BackendContract = + 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::BackendContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) backend_id: String, + pub(crate) parameters: models::BackendUpdateParameters, + pub(crate) if_match: 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/{}/backends/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.backend_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", "2018-06-01-preview"); + 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.header("If-Match", &self.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::NO_CONTENT => 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) backend_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/{}/backends/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.backend_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", "2018-06-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) backend_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/{}/backends/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.backend_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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 reconnect { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) backend_id: 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<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}/reconnect", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.backend_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", "2018-06-01-preview"); + 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::ACCEPTED => 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 cache { + use super::models; + 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(), + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_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(), + cache_id: cache_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_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(), + cache_id: cache_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + cache_id: cache_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_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(), + cache_id: cache_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, + cache_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(), + cache_id: cache_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) top: Option, + pub(crate) skip: Option, + } + impl Builder { + 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/{}/caches", + 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", "2018-06-01-preview"); + 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::CacheCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) cache_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/{}/caches/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.cache_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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CacheContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::CacheContract), + Ok200(models::CacheContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) cache_id: String, + pub(crate) parameters: models::CacheContract, + 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/{}/caches/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.cache_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", "2018-06-01-preview"); + 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::CacheContract = + 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::CacheContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) cache_id: String, + pub(crate) parameters: models::CacheUpdateParameters, + pub(crate) if_match: 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/{}/caches/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.cache_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", "2018-06-01-preview"); + 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.header("If-Match", &self.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::NO_CONTENT => 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) cache_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/{}/caches/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.cache_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", "2018-06-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) cache_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/{}/caches/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.cache_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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 certificate { + use super::models; + 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, + certificate_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(), + certificate_id: certificate_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + certificate_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(), + certificate_id: certificate_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, + certificate_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(), + certificate_id: certificate_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, + certificate_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(), + certificate_id: certificate_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/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", "2018-06-01-preview"); + 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::CertificateCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) certificate_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/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CertificateContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::CertificateContract), + Ok200(models::CertificateContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) certificate_id: String, + pub(crate) parameters: models::CertificateCreateOrUpdateParameters, + 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/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_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", "2018-06-01-preview"); + 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::CertificateContract = + 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::CertificateContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) certificate_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/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_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", "2018-06-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) certificate_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/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_management_operations { + use super::models; + 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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.ApiManagement/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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match 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 api_management_service_skus { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets available SKUs for API Management service"] + pub fn list_available_service_skus( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_available_service_skus::Builder { + list_available_service_skus::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_available_service_skus { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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, + } + impl Builder { + 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/{}/skus", + 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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceSkuResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod api_management_service { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn restore( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> restore::Builder { + restore::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn backup( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> backup::Builder { + backup::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: 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(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + 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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: 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(), + 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 fn get_sso_token( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> get_sso_token::Builder { + get_sso_token::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + 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 apply_network_configuration_updates( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> apply_network_configuration_updates::Builder { + apply_network_configuration_updates::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + pub fn upload_certificate( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> upload_certificate::Builder { + upload_certificate::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_hostname( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_hostname::Builder { + update_hostname::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod restore { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + 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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) parameters: models::ApiManagementServiceBackupRestoreParameters, + pub(crate) subscription_id: String, + } + impl Builder { + 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/{}/restore", + 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", "2018-06-01-preview"); + 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::ApiManagementServiceResource = + 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 backup { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + 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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) parameters: models::ApiManagementServiceBackupRestoreParameters, + pub(crate) subscription_id: String, + } + impl Builder { + 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/{}/backup", + 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", "2018-06-01-preview"); + 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::ApiManagementServiceResource = + 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; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -5465,27 +13110,14 @@ pub mod email_template { 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> { + 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/{}/templates", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -5501,15 +13133,6 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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)?; @@ -5518,17 +13141,15 @@ pub mod email_template { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateCollection = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; 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 { + Err(Error::UnexpectedResponse { status_code, - value: rsp_value, + body: rsp_body, }) } } @@ -5536,15 +13157,18 @@ pub mod email_template { } } } - pub mod get { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Created201(models::ApiManagementServiceResource), + Accepted202(models::ApiManagementServiceResource), + } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -5565,23 +13189,22 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, + pub(crate) parameters: models::ApiManagementServiceResource, 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.ApiManagement/service/{}/templates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.template_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5589,7 +13212,8 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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)?; @@ -5597,17 +13221,27 @@ pub mod email_template { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateContract = + let rsp_value: models::ApiManagementServiceResource = 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 => { + http::StatusCode::CREATED => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ErrorResponse = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { + 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::ApiManagementServiceResource = + 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, - value: rsp_value, + body: rsp_body, }) } } @@ -5615,20 +13249,17 @@ pub mod email_template { } } } - pub mod create_or_update { + pub mod update { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::EmailTemplateContract), - Ok200(models::EmailTemplateContract), + Ok200(models::ApiManagementServiceResource), + Accepted202, } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -5649,29 +13280,22 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, - pub(crate) parameters: models::EmailTemplateUpdateParameters, + pub(crate) parameters: models::ApiManagementServiceUpdateParameters, 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/{}/templates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.template_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5681,33 +13305,23 @@ pub mod email_template { url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); 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::EmailTemplateContract = - 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::EmailTemplateContract = + let rsp_value: models::ApiManagementServiceResource = 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 { + Err(Error::UnexpectedResponse { status_code, - value: rsp_value, + body: rsp_body, }) } } @@ -5715,15 +13329,18 @@ pub mod email_template { } } } - pub mod update { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::ApiManagementServiceResource), + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -5744,24 +13361,21 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, - pub(crate) parameters: models::EmailTemplateUpdateParameters, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/templates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.template_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5769,21 +13383,97 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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(()), + 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::ApiManagementServiceResource = + 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 = + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.ApiManagement/service", + 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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { status_code, - value: rsp_value, + body: rsp_body, }) } } @@ -5791,20 +13481,12 @@ pub mod email_template { } } } - pub mod delete { + pub mod list { use super::models; - #[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("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -5823,26 +13505,21 @@ pub mod email_template { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) template_name: 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> { + 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/{}/templates/{}", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/service", self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.template_name + &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::DELETE); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5850,22 +13527,23 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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 => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ErrorResponse = + let rsp_value: models::ApiManagementServiceListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { status_code, - value: rsp_value, + body: rsp_body, }) } } @@ -5873,15 +13551,12 @@ pub mod email_template { } } } - pub mod get_entity_tag { + pub mod get_sso_token { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -5902,23 +13577,24 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/templates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/getssotoken", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.template_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::HEAD); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5927,19 +13603,23 @@ pub mod email_template { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); 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 => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ErrorResponse = + let rsp_value: models::ApiManagementServiceGetSsoTokenResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { status_code, - value: rsp_value, + body: rsp_body, }) } } @@ -5947,121 +13627,12 @@ pub mod email_template { } } } -} -pub mod group { - use super::models; - 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, - group_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(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - group_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(), - group_id: group_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - group_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - group_id: group_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - group_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(), - group_id: group_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, - group_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(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod check_name_availability { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -6080,55 +13651,32 @@ pub mod group { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, + pub(crate) parameters: models::ApiManagementServiceCheckNameAvailabilityParameters, 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> { + 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/{}/groups", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/checkNameAvailability", self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name + &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", "2018-06-01-preview"); - 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.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); + 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)?; @@ -6136,17 +13684,15 @@ pub mod group { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GroupCollection = + let rsp_value: models::ApiManagementServiceNameAvailabilityResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; 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 { + Err(Error::UnexpectedResponse { status_code, - value: rsp_value, + body: rsp_body, }) } } @@ -6154,15 +13700,17 @@ pub mod group { } } } - pub mod get { + pub mod apply_network_configuration_updates { use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ApiManagementServiceResource), + } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -6183,23 +13731,20 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, pub(crate) subscription_id: String, + pub(crate) parameters: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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.ApiManagement/service/{}/groups/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/applynetworkconfigurationupdates" , 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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6207,25 +13752,29 @@ pub mod group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::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::GroupContract = + let rsp_value: models::ApiManagementServiceResource = 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)?; - let rsp_value: models::ErrorResponse = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { + Err(Error::UnexpectedResponse { status_code, - value: rsp_value, + body: rsp_body, }) } } @@ -6233,20 +13782,12 @@ pub mod group { } } } - pub mod create_or_update { + pub mod upload_certificate { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::GroupContract), - Ok200(models::GroupContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -6267,29 +13808,22 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) parameters: models::GroupCreateParameters, + pub(crate) parameters: models::ApiManagementServiceUploadCertificateParameters, 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> { + 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/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/updatecertificate", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.group_id + &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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6299,33 +13833,22 @@ pub mod group { url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); 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::GroupContract = - 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::GroupContract = + let rsp_value: models::CertificateInformation = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + 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 { + Err(Error::UnexpectedResponse { status_code, - value: rsp_value, + body: rsp_body, }) } } @@ -6333,15 +13856,17 @@ pub mod group { } } } - pub mod update { + pub mod update_hostname { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Accepted202(models::ApiManagementServiceResource), + } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -6362,25 +13887,22 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) parameters: models::GroupUpdateParameters, - pub(crate) if_match: String, + pub(crate) parameters: models::ApiManagementServiceUpdateHostnameParameters, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/updatehostname", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.group_id + &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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6390,20 +13912,28 @@ pub mod group { url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); 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.header("If-Match", &self.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::NO_CONTENT => Ok(()), - status_code => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ErrorResponse = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { + 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::ApiManagementServiceResource = + 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, - value: rsp_value, + body: rsp_body, }) } } @@ -6411,13 +13941,114 @@ pub mod group { } } } - pub mod delete { +} +pub mod diagnostic { + use super::models; + 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, + diagnostic_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(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + diagnostic_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(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + diagnostic_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + diagnostic_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(), + diagnostic_id: diagnostic_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, + diagnostic_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(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6445,24 +14076,36 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.group_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6470,15 +14113,27 @@ pub mod group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - req_builder = req_builder.header("If-Match", &self.if_match); + 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 => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -6493,7 +14148,7 @@ pub mod group { } } } - pub mod get_entity_tag { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6522,23 +14177,23 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, + pub(crate) diagnostic_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6552,7 +14207,12 @@ pub mod group { let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -6567,83 +14227,13 @@ pub mod group { } } } -} -pub mod group_user { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - resource_group_name: impl Into, - service_name: impl Into, - group_id: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - pub fn create( - &self, - resource_group_name: impl Into, - service_name: impl Into, - group_id: impl Into, - user_id: impl Into, - subscription_id: impl Into, - ) -> create::Builder { - create::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - group_id: group_id.into(), - user_id: user_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - group_id: impl Into, - user_id: 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(), - group_id: group_id.into(), - user_id: user_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn check_entity_exists( - &self, - resource_group_name: impl Into, - service_name: impl Into, - group_id: impl Into, - user_id: impl Into, - subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - group_id: group_id.into(), - user_id: user_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::DiagnosticContract), + Ok200(models::DiagnosticContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6671,38 +14261,29 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, + pub(crate) if_match: 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); + 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> { + 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/{}/groups/{}/users", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6710,26 +14291,27 @@ pub mod group_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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()); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::DiagnosticContract = + 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::UserCollection = + let rsp_value: models::DiagnosticContract = 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)?; @@ -6745,13 +14327,8 @@ pub mod group_user { } } } - pub mod create { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::UserContract), - Ok200(models::UserContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6779,25 +14356,25 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) user_id: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + pub(crate) if_match: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id, - &self.user_id + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6805,24 +14382,15 @@ pub mod group_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::UserContract = - 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::UserContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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::ErrorResponse = @@ -6871,21 +14439,20 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) user_id: String, + pub(crate) diagnostic_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/{}/groups/{}/users/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id, - &self.user_id + &self.diagnostic_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -6897,6 +14464,7 @@ pub mod group_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); + 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)?; @@ -6919,12 +14487,10 @@ pub mod group_user { } } } - pub mod check_entity_exists { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Error response #response_type")] - NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -6950,21 +14516,19 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) user_id: String, + pub(crate) diagnostic_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/{}/groups/{}/users/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id, - &self.user_id + &self.diagnostic_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -6982,8 +14546,7 @@ pub mod group_user { let 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(()), - http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + 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 = @@ -6999,7 +14562,7 @@ pub mod group_user { } } } -pub mod identity_provider { +pub mod email_template { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -7014,20 +14577,23 @@ pub mod identity_provider { 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, - identity_provider_name: impl Into, + template_name: 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(), - identity_provider_name: identity_provider_name.into(), + template_name: template_name.into(), subscription_id: subscription_id.into(), } } @@ -7035,15 +14601,15 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, - parameters: impl Into, + template_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(), service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), + template_name: template_name.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -7053,18 +14619,16 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, - parameters: impl Into, - if_match: impl Into, + template_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(), service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), + template_name: template_name.into(), parameters: parameters.into(), - if_match: if_match.into(), subscription_id: subscription_id.into(), } } @@ -7072,7 +14636,7 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, + template_name: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -7080,7 +14644,7 @@ pub mod identity_provider { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), + template_name: template_name.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -7089,14 +14653,14 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, + template_name: 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(), - identity_provider_name: identity_provider_name.into(), + template_name: template_name.into(), subscription_id: subscription_id.into(), } } @@ -7131,12 +14695,27 @@ pub mod identity_provider { 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 into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/identityProviders", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -7152,6 +14731,94 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); + 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::EmailTemplateCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) template_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.ApiManagement/service/{}/templates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.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", "2018-06-01-preview"); let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -7160,9 +14827,109 @@ pub mod identity_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IdentityProviderList = + let rsp_value: models::EmailTemplateContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::EmailTemplateContract), + Ok200(models::EmailTemplateContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) template_name: String, + pub(crate) parameters: models::EmailTemplateUpdateParameters, + 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/{}/templates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.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", "2018-06-01-preview"); + 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::EmailTemplateContract = + 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::EmailTemplateContract = 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)?; @@ -7178,7 +14945,7 @@ pub mod identity_provider { } } } - pub mod get { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7207,23 +14974,24 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, + pub(crate) template_name: String, + pub(crate) parameters: models::EmailTemplateUpdateParameters, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7231,18 +14999,14 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::IdentityProviderContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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::ErrorResponse = @@ -7257,12 +15021,12 @@ pub mod identity_provider { } } } - pub mod create_or_update { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::IdentityProviderContract), - Ok200(models::IdentityProviderContract), + Ok200, + NoContent204, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7291,29 +15055,24 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, - pub(crate) parameters: models::IdentityProviderContract, + pub(crate) template_name: String, + pub(crate) if_match: String, 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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7321,28 +15080,15 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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.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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IdentityProviderContract = - 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::IdentityProviderContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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 = @@ -7357,7 +15103,7 @@ pub mod identity_provider { } } } - pub mod update { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7386,25 +15132,23 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, - pub(crate) parameters: models::IdentityProviderUpdateParameters, - pub(crate) if_match: String, + pub(crate) template_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.ApiManagement/service/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7412,15 +15156,13 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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.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::NO_CONTENT => Ok(()), + 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 = @@ -7435,13 +15177,114 @@ pub mod identity_provider { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, +} +pub mod group { + use super::models; + 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, + group_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(), + group_id: group_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_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(), + group_id: group_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_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(), + group_id: group_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, + group_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(), + group_id: group_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7469,24 +15312,36 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, - pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.identity_provider_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7494,15 +15349,27 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - req_builder = req_builder.header("If-Match", &self.if_match); + 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 => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GroupCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -7517,7 +15384,7 @@ pub mod identity_provider { } } } - pub mod get_entity_tag { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7546,23 +15413,23 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, + pub(crate) group_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.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::HEAD); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7576,7 +15443,12 @@ pub mod identity_provider { let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GroupContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -7591,45 +15463,13 @@ pub mod identity_provider { } } } -} -pub mod issue { - use super::models; - 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, - issue_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(), - issue_id: issue_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::GroupContract), + Ok200(models::GroupContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7657,36 +15497,29 @@ pub mod issue { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) group_id: String, + pub(crate) parameters: models::GroupCreateParameters, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, + pub(crate) if_match: 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); + 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> { + 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/{}/issues", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7694,26 +15527,27 @@ pub mod issue { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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()); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::GroupContract = + 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::IssueCollection = + let rsp_value: models::GroupContract = 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)?; @@ -7729,7 +15563,7 @@ pub mod issue { } } } - pub mod get { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7758,23 +15592,25 @@ pub mod issue { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) issue_id: String, + pub(crate) group_id: String, + pub(crate) parameters: models::GroupUpdateParameters, + pub(crate) if_match: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/issues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.issue_id + &self.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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7782,18 +15618,15 @@ pub mod issue { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IssueContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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::ErrorResponse = @@ -7808,115 +15641,13 @@ pub mod issue { } } } -} -pub mod logger { - use super::models; - 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, - logger_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(), - logger_id: logger_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - logger_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(), - logger_id: logger_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - logger_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - logger_id: logger_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - logger_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(), - logger_id: logger_id.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - force: None, - } - } - pub fn get_entity_tag( - &self, - resource_group_name: impl Into, - service_name: impl Into, - logger_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(), - logger_id: logger_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7944,36 +15675,24 @@ pub mod logger { 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, + pub(crate) group_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, } 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> { + 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/{}/loggers", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7981,27 +15700,15 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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()); - } + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::LoggerCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -8016,7 +15723,7 @@ pub mod logger { } } } - pub mod get { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8045,23 +15752,23 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, + pub(crate) group_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8075,12 +15782,7 @@ pub mod logger { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::LoggerContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -8095,13 +15797,83 @@ pub mod logger { } } } - pub mod create_or_update { - use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::LoggerContract), - Ok200(models::LoggerContract), +} +pub mod group_user { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn create( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + user_id: 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(), + group_id: group_id.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } } + } + pub mod list { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8129,29 +15901,38 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, - pub(crate) parameters: models::LoggerContract, + pub(crate) group_id: String, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + 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> { + 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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.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::PUT); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8159,27 +15940,26 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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); + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::LoggerContract = - 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::LoggerContract = + let rsp_value: models::UserCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -8195,8 +15975,13 @@ pub mod logger { } } } - pub mod update { + pub mod create { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::UserContract), + Ok200(models::UserContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8224,25 +16009,25 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, - pub(crate) parameters: models::LoggerUpdateContract, - pub(crate) if_match: String, + pub(crate) group_id: String, + pub(crate) user_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.group_id, + &self.user_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8250,15 +16035,24 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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.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::NO_CONTENT => Ok(()), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UserContract = + 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::UserContract = + 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 = @@ -8307,25 +16101,21 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, - pub(crate) if_match: String, + pub(crate) group_id: String, + pub(crate) user_id: String, pub(crate) subscription_id: String, - pub(crate) force: Option, } impl Builder { - pub fn force(mut self, force: bool) -> Self { - self.force = Some(force); - 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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.group_id, + &self.user_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -8337,10 +16127,6 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - req_builder = req_builder.header("If-Match", &self.if_match); - if let Some(force) = &self.force { - url.query_pairs_mut().append_pair("force", &force.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)?; @@ -8363,10 +16149,12 @@ pub mod logger { } } } - pub mod get_entity_tag { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -8392,19 +16180,21 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, + pub(crate) group_id: String, + pub(crate) user_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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.group_id, + &self.user_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -8422,7 +16212,8 @@ pub mod logger { let rsp = 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(()), + http::StatusCode::NO_CONTENT => Ok(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -8438,7 +16229,7 @@ pub mod logger { } } } -pub mod notification { +pub mod identity_provider { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -8453,22 +16244,20 @@ pub mod notification { resource_group_name: resource_group_name.into(), service_name: service_name.into(), subscription_id: subscription_id.into(), - top: None, - skip: None, } } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - notification_name: impl Into, + identity_provider_name: 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(), - notification_name: notification_name.into(), + identity_provider_name: identity_provider_name.into(), subscription_id: subscription_id.into(), } } @@ -8476,18 +16265,71 @@ pub mod notification { &self, resource_group_name: impl Into, service_name: impl Into, - notification_name: impl Into, + identity_provider_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(), service_name: service_name.into(), - notification_name: notification_name.into(), + identity_provider_name: identity_provider_name.into(), + parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, } } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + identity_provider_name: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + identity_provider_name: identity_provider_name.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + identity_provider_name: 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(), + identity_provider_name: identity_provider_name.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, + identity_provider_name: 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(), + identity_provider_name: identity_provider_name.into(), + subscription_id: subscription_id.into(), + } + } } pub mod list_by_service { use super::models; @@ -8519,22 +16361,12 @@ pub mod notification { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) subscription_id: String, - pub(crate) top: Option, - pub(crate) skip: Option, } impl Builder { - 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> { + 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/{}/notifications", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -8550,12 +16382,6 @@ pub mod notification { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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)?; @@ -8564,7 +16390,7 @@ pub mod notification { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NotificationCollection = + let rsp_value: models::IdentityProviderList = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -8611,19 +16437,19 @@ pub mod notification { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, + pub(crate) identity_provider_name: String, 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.ApiManagement/service/{}/notifications/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.notification_name + &self.identity_provider_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -8643,7 +16469,7 @@ pub mod notification { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NotificationContract = + let rsp_value: models::IdentityProviderContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -8663,6 +16489,11 @@ pub mod notification { } pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::IdentityProviderContract), + Ok200(models::IdentityProviderContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8690,7 +16521,8 @@ pub mod notification { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, + pub(crate) identity_provider_name: String, + pub(crate) parameters: models::IdentityProviderContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -8699,15 +16531,15 @@ pub mod notification { self.if_match = Some(if_match.into()); self } - 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.ApiManagement/service/{}/notifications/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.notification_name + &self.identity_provider_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -8719,20 +16551,27 @@ pub mod notification { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::IdentityProviderContract = + 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::NotificationContract = + let rsp_value: models::IdentityProviderContract = 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)?; @@ -8748,80 +16587,91 @@ pub mod notification { } } } -} -pub mod notification_recipient_user { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_notification( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - subscription_id: impl Into, - ) -> list_by_notification::Builder { - list_by_notification::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - notification_name: notification_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - user_id: 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(), - notification_name: notification_name.into(), - user_id: user_id.into(), - subscription_id: subscription_id.into(), - } + pub mod update { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - user_id: 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(), - notification_name: notification_name.into(), - user_id: user_id.into(), - subscription_id: subscription_id.into(), - } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) identity_provider_name: String, + pub(crate) parameters: models::IdentityProviderUpdateParameters, + pub(crate) if_match: String, + pub(crate) subscription_id: String, } - pub fn check_entity_exists( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - user_id: impl Into, - subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - notification_name: notification_name.into(), - user_id: user_id.into(), - subscription_id: subscription_id.into(), + 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/{}/identityProviders/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.identity_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::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", "2018-06-01-preview"); + 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.header("If-Match", &self.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::NO_CONTENT => 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_by_notification { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8849,16 +16699,24 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, + pub(crate) identity_provider_name: 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> { + 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/{}/notifications/{}/recipientUsers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.identity_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8866,18 +16724,15 @@ pub mod notification_recipient_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientUserCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -8892,13 +16747,8 @@ pub mod notification_recipient_user { } } } - pub mod create_or_update { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::RecipientUserContract), - Ok200(models::RecipientUserContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8926,17 +16776,23 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) user_id: String, + pub(crate) identity_provider_name: String, 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<(), Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.identity_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8950,18 +16806,7 @@ pub mod notification_recipient_user { let 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::RecipientUserContract = - 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::RecipientUserContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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 = @@ -8976,13 +16821,45 @@ pub mod notification_recipient_user { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, +} +pub mod issue { + use super::models; + 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, + issue_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(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + } } + } + pub mod list_by_service { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9010,17 +16887,36 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) user_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/issues", + 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9028,14 +16924,27 @@ pub mod notification_recipient_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); + 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 => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -9050,7 +16959,7 @@ pub mod notification_recipient_user { } } } - pub mod check_entity_exists { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9079,17 +16988,23 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) user_id: String, + pub(crate) issue_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.issue_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9103,7 +17018,12 @@ pub mod notification_recipient_user { let 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -9119,22 +17039,38 @@ pub mod notification_recipient_user { } } } -pub mod notification_recipient_email { +pub mod logger { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_notification( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - notification_name: impl Into, subscription_id: impl Into, - ) -> list_by_notification::Builder { - list_by_notification::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - notification_name: notification_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, + logger_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(), + logger_id: logger_id.into(), subscription_id: subscription_id.into(), } } @@ -9142,55 +17078,74 @@ pub mod notification_recipient_email { &self, resource_group_name: impl Into, service_name: impl Into, - notification_name: impl Into, - email: impl Into, + logger_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(), - notification_name: notification_name.into(), - email: email.into(), + logger_id: logger_id.into(), + parameters: parameters.into(), subscription_id: subscription_id.into(), + if_match: None, } } - pub fn delete( + pub fn update( &self, resource_group_name: impl Into, service_name: impl Into, - notification_name: impl Into, - email: impl Into, + logger_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + logger_id: logger_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + logger_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(), - notification_name: notification_name.into(), - email: email.into(), + logger_id: logger_id.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), + force: None, } } - pub fn check_entity_exists( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, - notification_name: impl Into, - email: impl Into, + logger_id: impl Into, subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - notification_name: notification_name.into(), - email: email.into(), + logger_id: logger_id.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_notification { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9219,13 +17174,33 @@ pub mod notification_recipient_email { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/notifications/{}/recipientEmails" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers", + 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); @@ -9236,6 +17211,15 @@ pub mod notification_recipient_email { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); + 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)?; @@ -9244,7 +17228,7 @@ pub mod notification_recipient_email { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientEmailCollection = + let rsp_value: models::LoggerCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -9262,13 +17246,8 @@ pub mod notification_recipient_email { } } } - pub mod create_or_update { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::RecipientEmailContract), - Ok200(models::RecipientEmailContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9296,17 +17275,23 @@ pub mod notification_recipient_email { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) email: String, + pub(crate) logger_id: String, 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.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.logger_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9320,17 +17305,11 @@ pub mod notification_recipient_email { let 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::RecipientEmailContract = - 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::RecipientEmailContract = + let rsp_value: models::LoggerContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -9346,12 +17325,12 @@ pub mod notification_recipient_email { } } } - pub mod delete { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200, - NoContent204, + Created201(models::LoggerContract), + Ok200(models::LoggerContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9380,17 +17359,29 @@ pub mod notification_recipient_email { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) email: String, + pub(crate) logger_id: String, + pub(crate) parameters: models::LoggerContract, 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/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.logger_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9398,14 +17389,28 @@ pub mod notification_recipient_email { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoggerContract = + 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::LoggerContract = + 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 = @@ -9420,7 +17425,7 @@ pub mod notification_recipient_email { } } } - pub mod check_entity_exists { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9449,17 +17454,25 @@ pub mod notification_recipient_email { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) email: String, + pub(crate) logger_id: String, + pub(crate) parameters: models::LoggerUpdateContract, + pub(crate) if_match: 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/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.logger_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9467,7 +17480,9 @@ pub mod notification_recipient_email { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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)?; @@ -9488,42 +17503,13 @@ pub mod notification_recipient_email { } } } -} -pub mod network_status { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_service( - &self, - subscription_id: impl Into, - resource_group_name: impl Into, - service_name: impl Into, - ) -> list_by_service::Builder { - list_by_service::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_by_location( - &self, - subscription_id: impl Into, - resource_group_name: impl Into, - service_name: impl Into, - location_name: impl Into, - ) -> list_by_location::Builder { - list_by_location::Builder { - client: self.0.clone(), - subscription_id: subscription_id.into(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - location_name: location_name.into(), - } - } - } - pub mod list_by_service { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9549,25 +17535,31 @@ pub mod network_status { #[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) logger_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + pub(crate) force: Option, } impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + pub fn force(mut self, force: bool) -> Self { + self.force = Some(force); + 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/{}/networkstatus", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.logger_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9575,18 +17567,18 @@ pub mod network_status { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + if let Some(force) = &self.force { + url.query_pairs_mut().append_pair("force", &force.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: Vec = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -9601,7 +17593,7 @@ pub mod network_status { } } } - pub mod list_by_location { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9628,25 +17620,25 @@ pub mod network_status { #[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) location_name: String, + pub(crate) logger_id: String, + 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/locations/{}/networkstatus", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.location_name + &self.logger_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9657,15 +17649,10 @@ pub mod network_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::NetworkStatusContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + let rsp = 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 = @@ -9681,7 +17668,7 @@ pub mod network_status { } } } -pub mod open_id_connect_provider { +pub mod notification { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -9696,7 +17683,6 @@ pub mod open_id_connect_provider { resource_group_name: resource_group_name.into(), service_name: service_name.into(), subscription_id: subscription_id.into(), - filter: None, top: None, skip: None, } @@ -9705,14 +17691,14 @@ pub mod open_id_connect_provider { &self, resource_group_name: impl Into, service_name: impl Into, - opid: impl Into, + notification_name: 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(), - opid: opid.into(), + notification_name: notification_name.into(), subscription_id: subscription_id.into(), } } @@ -9720,71 +17706,18 @@ pub mod open_id_connect_provider { &self, resource_group_name: impl Into, service_name: impl Into, - opid: impl Into, - parameters: impl Into, + notification_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(), service_name: service_name.into(), - opid: opid.into(), - parameters: parameters.into(), + notification_name: notification_name.into(), subscription_id: subscription_id.into(), if_match: None, } } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - opid: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - opid: opid.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - opid: 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(), - opid: opid.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, - opid: 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(), - opid: opid.into(), - subscription_id: subscription_id.into(), - } - } } pub mod list_by_service { use super::models; @@ -9816,15 +17749,10 @@ pub mod open_id_connect_provider { 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 @@ -9833,12 +17761,10 @@ pub mod open_id_connect_provider { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/openidConnectProviders", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -9854,9 +17780,6 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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()); } @@ -9871,7 +17794,7 @@ pub mod open_id_connect_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OpenIdConnectProviderCollection = + let rsp_value: models::NotificationCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -9918,21 +17841,19 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, + pub(crate) notification_name: String, 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.ApiManagement/service/{}/openidConnectProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.opid + &self.notification_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -9952,7 +17873,7 @@ pub mod open_id_connect_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OpenidConnectProviderContract = + let rsp_value: models::NotificationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -9972,11 +17893,6 @@ pub mod open_id_connect_provider { } pub mod create_or_update { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::OpenidConnectProviderContract), - Ok200(models::OpenidConnectProviderContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -10004,8 +17920,7 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, - pub(crate) parameters: models::OpenidConnectProviderContract, + pub(crate) notification_name: String, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -10014,15 +17929,15 @@ pub mod open_id_connect_provider { self.if_match = Some(if_match.into()); self } - 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.ApiManagement/service/{}/openidConnectProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.opid + &self.notification_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -10034,27 +17949,164 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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); } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NotificationContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 notification_recipient_user { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_notification( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + subscription_id: impl Into, + ) -> list_by_notification::Builder { + list_by_notification::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + user_id: 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(), + notification_name: notification_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + user_id: 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(), + notification_name: notification_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_notification { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) notification_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.ApiManagement/service/{}/notifications/{}/recipientUsers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::OpenidConnectProviderContract = - 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::OpenidConnectProviderContract = + let rsp_value: models::RecipientUserCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -10070,8 +18122,13 @@ pub mod open_id_connect_provider { } } } - pub mod update { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::RecipientUserContract), + Ok200(models::RecipientUserContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -10099,25 +18156,17 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, - pub(crate) parameters: models::OpenidConnectProviderUpdateContract, - pub(crate) if_match: String, + pub(crate) notification_name: String, + pub(crate) user_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -10125,15 +18174,24 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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.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::NO_CONTENT => Ok(()), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecipientUserContract = + 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::RecipientUserContract = + 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 = @@ -10182,21 +18240,14 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, - pub(crate) if_match: String, + pub(crate) notification_name: String, + pub(crate) user_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/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_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); @@ -10207,7 +18258,6 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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)?; @@ -10230,7 +18280,7 @@ pub mod open_id_connect_provider { } } } - pub mod get_entity_tag { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -10259,20 +18309,14 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, + pub(crate) notification_name: String, + pub(crate) user_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/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_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); @@ -10289,7 +18333,7 @@ pub mod open_id_connect_provider { let rsp = 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(()), + 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::ErrorResponse = @@ -10305,35 +18349,22 @@ pub mod open_id_connect_provider { } } } -pub mod policy { +pub mod notification_recipient_email { use super::models; 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(), - } - } - pub fn get( + pub fn list_by_notification( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, + notification_name: impl Into, subscription_id: impl Into, - ) -> get::Builder { - get::Builder { + ) -> list_by_notification::Builder { + list_by_notification::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - policy_id: policy_id.into(), + notification_name: notification_name.into(), subscription_id: subscription_id.into(), } } @@ -10341,55 +18372,217 @@ pub mod policy { &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, - parameters: impl Into, + notification_name: impl Into, + email: 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(), - policy_id: policy_id.into(), - parameters: parameters.into(), + notification_name: notification_name.into(), + email: email.into(), subscription_id: subscription_id.into(), - if_match: None, } } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, - if_match: impl Into, + notification_name: impl Into, + email: 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(), - policy_id: policy_id.into(), - if_match: if_match.into(), + notification_name: notification_name.into(), + email: email.into(), subscription_id: subscription_id.into(), } } - pub fn get_entity_tag( + pub fn check_entity_exists( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, + notification_name: impl Into, + email: impl Into, subscription_id: impl Into, - ) -> get_entity_tag::Builder { - get_entity_tag::Builder { + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - policy_id: policy_id.into(), + notification_name: notification_name.into(), + email: email.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_service { + pub mod list_by_notification { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) notification_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.ApiManagement/service/{}/notifications/{}/recipientEmails" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecipientEmailCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::RecipientEmailContract), + Ok200(models::RecipientEmailContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) notification_name: String, + pub(crate) email: 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/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let mut url = 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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::RecipientEmailContract = + 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::RecipientEmailContract = + 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 delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -10417,21 +18610,17 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) notification_name: String, + pub(crate) email: String, 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.ApiManagement/service/{}/policies", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -10445,12 +18634,8 @@ pub mod policy { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match 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) - } + 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 = @@ -10465,7 +18650,7 @@ pub mod policy { } } } - pub mod get { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -10494,23 +18679,17 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, + pub(crate) notification_name: String, + pub(crate) email: String, 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<(), Error>> { Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.policy_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -10524,12 +18703,7 @@ pub mod policy { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PolicyContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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::ErrorResponse = @@ -10544,13 +18718,42 @@ pub mod policy { } } } - pub mod create_or_update { - use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::PolicyContract), - Ok200(models::PolicyContract), +} +pub mod network_status { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> list_by_service::Builder { + list_by_service::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_by_location( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + location_name: impl Into, + ) -> list_by_location::Builder { + list_by_location::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + location_name: location_name.into(), + } } + } + pub mod list_by_service { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -10576,31 +18779,25 @@ pub mod policy { #[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) policy_id: String, - pub(crate) parameters: models::PolicyContract, - 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> { + 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/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/networkstatus", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.policy_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -10608,27 +18805,17 @@ pub mod policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::PolicyContract = - 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::PolicyContract = + let rsp_value: Vec = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -10644,13 +18831,8 @@ pub mod policy { } } } - pub mod delete { + pub mod list_by_location { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -10676,26 +18858,25 @@ pub mod policy { #[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) policy_id: String, - pub(crate) if_match: String, - pub(crate) subscription_id: String, + pub(crate) location_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.ApiManagement/service/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/locations/{}/networkstatus", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.policy_id + &self.location_name ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -10703,15 +18884,18 @@ pub mod policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkStatusContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -10726,7 +18910,113 @@ pub mod policy { } } } - pub mod get_entity_tag { +} +pub mod open_id_connect_provider { + use super::models; + 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, + opid: 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(), + opid: opid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: 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(), + opid: opid.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + opid: opid.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: 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(), + opid: opid.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, + opid: 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(), + opid: opid.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -10755,23 +19045,38 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.policy_id + &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::HEAD); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -10779,13 +19084,27 @@ pub mod policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); + 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 => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenIdConnectProviderCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -10800,27 +19119,7 @@ pub mod policy { } } } -} -pub mod policy_snippets { - use super::models; - 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(), - scope: None, - } - } - } - pub mod list_by_service { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -10849,22 +19148,21 @@ pub mod policy_snippets { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) opid: String, pub(crate) subscription_id: String, - pub(crate) scope: Option, } impl Builder { - pub fn scope(mut self, scope: impl Into) -> Self { - self.scope = Some(scope.into()); - self - } - 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.ApiManagement/service/{}/policySnippets", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.opid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -10876,9 +19174,6 @@ pub mod policy_snippets { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - if let Some(scope) = &self.scope { - url.query_pairs_mut().append_pair("scope", scope); - } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -10887,7 +19182,7 @@ pub mod policy_snippets { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PolicySnippetsCollection = + let rsp_value: models::OpenidConnectProviderContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -10905,73 +19200,13 @@ pub mod policy_snippets { } } } -} -pub mod sign_in_settings { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - resource_group_name: impl Into, - service_name: 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(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - 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(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - parameters: parameters.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, - 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(), - subscription_id: subscription_id.into(), - } - } - } - pub mod get { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::OpenidConnectProviderContract), + Ok200(models::OpenidConnectProviderContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -10999,21 +19234,29 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) opid: String, + pub(crate) parameters: models::OpenidConnectProviderContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.opid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11021,17 +19264,27 @@ pub mod sign_in_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::OpenidConnectProviderContract = + 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::PortalSigninSettings = + let rsp_value: models::OpenidConnectProviderContract = 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)?; @@ -11047,7 +19300,7 @@ pub mod sign_in_settings { } } } - pub mod create_or_update { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11076,27 +19329,25 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSigninSettings, + pub(crate) opid: String, + pub(crate) parameters: models::OpenidConnectProviderUpdateContract, + pub(crate) if_match: String, 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> { + 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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.opid ); let mut url = 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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11106,20 +19357,13 @@ pub mod sign_in_settings { url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); 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.header("If-Match", &self.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::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSigninSettings = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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::ErrorResponse = @@ -11134,8 +19378,13 @@ pub mod sign_in_settings { } } } - pub mod update { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -11163,23 +19412,24 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSigninSettings, + pub(crate) opid: 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<(), Error>> { + 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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.opid ); let mut url = 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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11187,15 +19437,15 @@ pub mod sign_in_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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.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::NO_CONTENT => Ok(()), + 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 = @@ -11239,17 +19489,19 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) opid: 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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.opid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -11283,20 +19535,35 @@ pub mod sign_in_settings { } } } -pub mod sign_up_settings { +pub mod policy { use super::models; 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(), + } + } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, + policy_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(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), } } @@ -11304,31 +19571,33 @@ pub mod sign_up_settings { &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + policy_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(), + policy_id: policy_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, } } - pub fn update( + pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + policy_id: impl Into, if_match: impl Into, subscription_id: impl Into, - ) -> update::Builder { - update::Builder { + ) -> delete::Builder { + delete::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - parameters: parameters.into(), + policy_id: policy_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -11337,17 +19606,19 @@ pub mod sign_up_settings { &self, resource_group_name: impl Into, service_name: impl Into, + policy_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(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), } } } - pub mod get { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11379,10 +19650,10 @@ pub mod sign_up_settings { 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.ApiManagement/service/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -11406,9 +19677,188 @@ pub mod sign_up_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSignupSettings = + 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)?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) policy_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/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.policy_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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) policy_id: String, + pub(crate) parameters: models::PolicyContract, + 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/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.policy_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", "2018-06-01-preview"); + 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::PolicyContract = + 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::PolicyContract = 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)?; @@ -11424,8 +19874,13 @@ pub mod sign_up_settings { } } } - pub mod create_or_update { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -11453,27 +19908,24 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSignupSettings, + pub(crate) policy_id: String, + pub(crate) if_match: String, 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> { + 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/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11481,22 +19933,15 @@ pub mod sign_up_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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.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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSignupSettings = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -11511,7 +19956,7 @@ pub mod sign_up_settings { } } } - pub mod update { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11540,23 +19985,23 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSignupSettings, - pub(crate) if_match: String, + pub(crate) policy_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/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11564,15 +20009,13 @@ pub mod sign_up_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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.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::NO_CONTENT => Ok(()), + 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 = @@ -11587,7 +20030,27 @@ pub mod sign_up_settings { } } } - pub mod get_entity_tag { +} +pub mod policy_snippets { + use super::models; + 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(), + scope: None, + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11617,12 +20080,17 @@ pub mod sign_up_settings { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) subscription_id: String, + pub(crate) scope: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + pub fn scope(mut self, scope: impl Into) -> Self { + self.scope = Some(scope.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/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policySnippets", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -11630,7 +20098,7 @@ pub mod sign_up_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11638,13 +20106,21 @@ pub mod sign_up_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); + if let Some(scope) = &self.scope { + url.query_pairs_mut().append_pair("scope", scope); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicySnippetsCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -11660,7 +20136,7 @@ pub mod sign_up_settings { } } } -pub mod delegation_settings { +pub mod sign_in_settings { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -11681,7 +20157,7 @@ pub mod delegation_settings { &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + parameters: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -11697,7 +20173,7 @@ pub mod delegation_settings { &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -11756,10 +20232,10 @@ pub mod delegation_settings { 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.ApiManagement/service/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -11783,7 +20259,7 @@ pub mod delegation_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalDelegationSettings = + let rsp_value: models::PortalSigninSettings = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -11830,7 +20306,7 @@ pub mod delegation_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalDelegationSettings, + pub(crate) parameters: models::PortalSigninSettings, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -11839,10 +20315,10 @@ pub mod delegation_settings { self.if_match = Some(if_match.into()); self } - 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.ApiManagement/service/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -11870,7 +20346,7 @@ pub mod delegation_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalDelegationSettings = + let rsp_value: models::PortalSigninSettings = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -11917,7 +20393,7 @@ pub mod delegation_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalDelegationSettings, + pub(crate) parameters: models::PortalSigninSettings, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -11925,7 +20401,7 @@ pub mod delegation_settings { 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/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -11999,7 +20475,7 @@ pub mod delegation_settings { 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/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -12037,40 +20513,20 @@ pub mod delegation_settings { } } } -pub mod product { +pub mod sign_up_settings { use super::models; 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, - expand_groups: None, - tags: None, - } - } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - product_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(), - product_id: product_id.into(), subscription_id: subscription_id.into(), } } @@ -12078,15 +20534,13 @@ pub mod product { &self, resource_group_name: impl Into, service_name: impl Into, - product_id: impl Into, - parameters: 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(), - product_id: product_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -12096,8 +20550,7 @@ pub mod product { &self, resource_group_name: impl Into, service_name: impl Into, - product_id: impl Into, - parameters: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -12105,64 +20558,103 @@ pub mod product { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - product_id: product_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_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(), - product_id: product_id.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - delete_subscriptions: None, - } - } pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, - product_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(), - product_id: product_id.into(), subscription_id: subscription_id.into(), } } - pub fn list_by_tags( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> list_by_tags::Builder { - list_by_tags::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, - include_not_tagged_products: None, + } + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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, + } + impl Builder { + 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/{}/portalsettings/signup", + 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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalSignupSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_service { + pub mod create_or_update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12191,38 +20683,19 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) parameters: models::PortalSignupSettings, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, - pub(crate) expand_groups: Option, - pub(crate) tags: Option, + pub(crate) if_match: 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 expand_groups(mut self, expand_groups: bool) -> Self { - self.expand_groups = Some(expand_groups); - self - } - pub fn tags(mut self, tags: impl Into) -> Self { - self.tags = Some(tags.into()); + 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> { + 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/{}/products", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -12230,7 +20703,7 @@ pub mod product { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12238,22 +20711,11 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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()); - } - if let Some(expand_groups) = &self.expand_groups { - url.query_pairs_mut().append_pair("expandGroups", &expand_groups.to_string()); - } - if let Some(tags) = &self.tags { - url.query_pairs_mut().append_pair("tags", tags); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -12261,7 +20723,7 @@ pub mod product { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProductCollection = + let rsp_value: models::PortalSignupSettings = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -12279,7 +20741,7 @@ pub mod product { } } } - pub mod get { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12308,23 +20770,23 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, + pub(crate) parameters: models::PortalSignupSettings, + pub(crate) if_match: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12332,18 +20794,15 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProductContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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::ErrorResponse = @@ -12358,13 +20817,8 @@ pub mod product { } } } - pub mod create_or_update { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ProductContract), - Ok200(models::ProductContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12392,29 +20846,21 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) parameters: models::ProductContract, 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> { + 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12422,28 +20868,13 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ProductContract = - 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::ProductContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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 = @@ -12458,7 +20889,72 @@ pub mod product { } } } - pub mod update { +} +pub mod delegation_settings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + service_name: 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(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + 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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.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, + 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(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12487,25 +20983,21 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) parameters: models::ProductUpdateParameters, - pub(crate) if_match: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12513,15 +21005,18 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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.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::NO_CONTENT => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalDelegationSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -12536,13 +21031,8 @@ pub mod product { } } } - pub mod delete { + pub mod create_or_update { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12570,29 +21060,27 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) if_match: String, + pub(crate) parameters: models::PortalDelegationSettings, pub(crate) subscription_id: String, - pub(crate) delete_subscriptions: Option, + pub(crate) if_match: Option, } impl Builder { - pub fn delete_subscriptions(mut self, delete_subscriptions: bool) -> Self { - self.delete_subscriptions = Some(delete_subscriptions); + 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> { + 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12600,19 +21088,22 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - req_builder = req_builder.header("If-Match", &self.if_match); - if let Some(delete_subscriptions) = &self.delete_subscriptions { - url.query_pairs_mut() - .append_pair("deleteSubscriptions", &delete_subscriptions.to_string()); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalDelegationSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -12627,7 +21118,7 @@ pub mod product { } } } - pub mod get_entity_tag { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12656,23 +21147,23 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, + pub(crate) parameters: models::PortalDelegationSettings, + pub(crate) if_match: 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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::HEAD); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12680,13 +21171,15 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => Ok(()), + 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::ErrorResponse = @@ -12701,7 +21194,7 @@ pub mod product { } } } - pub mod list_by_tags { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12731,32 +21224,12 @@ pub mod product { 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, - pub(crate) include_not_tagged_products: 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 include_not_tagged_products(mut self, include_not_tagged_products: bool) -> Self { - self.include_not_tagged_products = Some(include_not_tagged_products); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/productsByTags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -12764,7 +21237,7 @@ pub mod product { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12772,31 +21245,13 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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()); - } - if let Some(include_not_tagged_products) = &self.include_not_tagged_products { - url.query_pairs_mut() - .append_pair("includeNotTaggedProducts", &include_not_tagged_products.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::TagResourceCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -12812,26 +21267,41 @@ pub mod product { } } } -pub mod product_api { +pub mod product { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_product( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - product_id: impl Into, subscription_id: impl Into, - ) -> list_by_product::Builder { - list_by_product::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - product_id: product_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, + expand_groups: None, + tags: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_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(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), } } pub fn create_or_update( @@ -12839,7 +21309,7 @@ pub mod product_api { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - api_id: impl Into, + parameters: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -12847,7 +21317,27 @@ pub mod product_api { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - api_id: api_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } @@ -12856,7 +21346,7 @@ pub mod product_api { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - api_id: impl Into, + if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { delete::Builder { @@ -12864,138 +21354,46 @@ pub mod product_api { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - api_id: api_id.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), + delete_subscriptions: None, } } - pub fn check_entity_exists( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - api_id: impl Into, subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - api_id: api_id.into(), subscription_id: subscription_id.into(), } } - } - pub mod list_by_product { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: 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/{}/products/{}/apis", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_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", "2018-06-01-preview"); - 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::ApiCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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 list_by_tags( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_tags::Builder { + list_by_tags::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, + include_not_tagged_products: None, } } } - pub mod create_or_update { + pub mod list_by_service { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ApiContract), - Ok200(models::ApiContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13023,25 +21421,46 @@ pub mod product_api { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) api_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) expand_groups: Option, + pub(crate) tags: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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 expand_groups(mut self, expand_groups: bool) -> Self { + self.expand_groups = Some(expand_groups); + self + } + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.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/{}/products/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.api_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13049,23 +21468,32 @@ pub mod product_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); + 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()); + } + if let Some(expand_groups) = &self.expand_groups { + url.query_pairs_mut().append_pair("expandGroups", &expand_groups.to_string()); + } + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ApiContract = - 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::ApiContract = + let rsp_value: models::ProductCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -13081,13 +21509,8 @@ pub mod product_api { } } } - pub mod delete { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13116,24 +21539,22 @@ pub mod product_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) api_id: String, 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.ApiManagement/service/{}/products/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.api_id + &self.product_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13147,175 +21568,33 @@ pub mod product_api { let rsp = 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 => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ErrorResponse = + let rsp_value: models::ProductContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) + Ok(rsp_value) } - } - }) - } - } - } - pub mod check_entity_exists { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: String, - pub(crate) api_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/{}/products/{}/apis/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.api_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", "2018-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let 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::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 product_group { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - subscription_id: impl Into, - ) -> list_by_product::Builder { - list_by_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - group_id: 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(), - product_id: product_id.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - group_id: 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(), - product_id: product_id.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn check_entity_exists( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - group_id: impl Into, - subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), + 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_product { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ProductContract), + Ok200(models::ProductContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13344,28 +21623,19 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, + pub(crate) parameters: models::ProductContract, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, + pub(crate) if_match: 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); + 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> { + 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/{}/products/{}/groups", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -13374,7 +21644,7 @@ pub mod product_group { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13382,26 +21652,27 @@ pub mod product_group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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()); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ProductContract = + 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::GroupCollection = + let rsp_value: models::ProductContract = 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)?; @@ -13417,13 +21688,8 @@ pub mod product_group { } } } - pub mod create_or_update { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::GroupContract), - Ok200(models::GroupContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13452,24 +21718,24 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) group_id: String, + pub(crate) parameters: models::ProductUpdateParameters, + pub(crate) if_match: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.group_id + &self.product_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13477,24 +21743,15 @@ pub mod product_group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::GroupContract = - 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::GroupContract = - 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(()), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -13544,20 +21801,24 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) group_id: String, + pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) delete_subscriptions: Option, } impl Builder { + pub fn delete_subscriptions(mut self, delete_subscriptions: bool) -> Self { + self.delete_subscriptions = Some(delete_subscriptions); + 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/{}/products/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.group_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -13569,6 +21830,11 @@ pub mod product_group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + if let Some(delete_subscriptions) = &self.delete_subscriptions { + url.query_pairs_mut() + .append_pair("deleteSubscriptions", &delete_subscriptions.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)?; @@ -13591,7 +21857,7 @@ pub mod product_group { } } } - pub mod check_entity_exists { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13621,20 +21887,18 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) group_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/{}/products/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.group_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -13652,7 +21916,7 @@ pub mod product_group { let 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(()), + 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 = @@ -13667,31 +21931,7 @@ pub mod product_group { } } } -} -pub mod product_subscriptions { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - } - pub mod list { + pub mod list_by_tags { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13720,11 +21960,11 @@ pub mod product_subscriptions { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, + pub(crate) include_not_tagged_products: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -13739,15 +21979,18 @@ pub mod product_subscriptions { self.skip = Some(skip); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn include_not_tagged_products(mut self, include_not_tagged_products: bool) -> Self { + self.include_not_tagged_products = Some(include_not_tagged_products); + 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/{}/products/{}/subscriptions", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/productsByTags", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &self.service_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -13768,6 +22011,10 @@ pub mod product_subscriptions { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } + if let Some(include_not_tagged_products) = &self.include_not_tagged_products { + url.query_pairs_mut() + .append_pair("includeNotTaggedProducts", &include_not_tagged_products.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)?; @@ -13776,7 +22023,7 @@ pub mod product_subscriptions { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::SubscriptionCollection = + let rsp_value: models::TagResourceCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -13795,7 +22042,7 @@ pub mod product_subscriptions { } } } -pub mod product_policy { +pub mod product_api { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -13812,23 +22059,9 @@ pub mod product_policy { service_name: service_name.into(), product_id: product_id.into(), subscription_id: subscription_id.into(), - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - policy_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(), - product_id: product_id.into(), - policy_id: policy_id.into(), - subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, } } pub fn create_or_update( @@ -13836,8 +22069,7 @@ pub mod product_policy { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - policy_id: impl Into, - parameters: impl Into, + api_id: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -13845,10 +22077,8 @@ pub mod product_policy { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - policy_id: policy_id.into(), - parameters: parameters.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), - if_match: None, } } pub fn delete( @@ -13856,8 +22086,7 @@ pub mod product_policy { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - policy_id: impl Into, - if_match: impl Into, + api_id: impl Into, subscription_id: impl Into, ) -> delete::Builder { delete::Builder { @@ -13865,109 +22094,29 @@ pub mod product_policy { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - policy_id: policy_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, - product_id: impl Into, - policy_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(), - product_id: product_id.into(), - policy_id: policy_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_product { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: String, - pub(crate) subscription_id: String, + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } } - impl Builder { - 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/{}/products/{}/policies", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_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", "2018-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match 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)?; - 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 check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), } } } - pub mod get { + pub mod list_by_product { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13997,20 +22146,33 @@ pub mod product_policy { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) policy_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/products/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.policy_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -14022,6 +22184,15 @@ pub mod product_policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); + 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)?; @@ -14030,7 +22201,7 @@ pub mod product_policy { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PolicyContract = + let rsp_value: models::ApiCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -14052,8 +22223,8 @@ pub mod product_policy { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::PolicyContract), - Ok200(models::PolicyContract), + Created201(models::ApiContract), + Ok200(models::ApiContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14083,26 +22254,20 @@ pub mod product_policy { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) policy_id: String, - pub(crate) parameters: models::PolicyContract, + pub(crate) api_id: String, 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/{}/products/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.policy_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -14114,11 +22279,7 @@ pub mod product_policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - if let Some(if_match) = &self.if_match { - req_builder = req_builder.header("If-Match", if_match); - } - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -14126,13 +22287,13 @@ pub mod product_policy { 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::PolicyContract = + let rsp_value: models::ApiContract = 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::PolicyContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -14185,21 +22346,20 @@ pub mod product_policy { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) policy_id: String, - pub(crate) if_match: String, + pub(crate) api_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/{}/products/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.policy_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -14211,7 +22371,6 @@ pub mod product_policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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)?; @@ -14234,7 +22393,7 @@ pub mod product_policy { } } } - pub mod get_entity_tag { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14260,213 +22419,93 @@ pub mod product_policy { } #[derive(Clone)] pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) policy_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/{}/products/{}/policies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.policy_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", "2018-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = 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 tag { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - subscription_id: impl Into, - ) -> list_by_product::Builder { - list_by_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - pub fn get_by_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - tag_id: impl Into, - subscription_id: impl Into, - ) -> get_by_product::Builder { - get_by_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn assign_to_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - tag_id: impl Into, - subscription_id: impl Into, - ) -> assign_to_product::Builder { - assign_to_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn detach_from_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - tag_id: impl Into, - subscription_id: impl Into, - ) -> detach_from_product::Builder { - detach_from_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) api_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/{}/products/{}/apis/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.api_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", "2018-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::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 get_entity_state_by_product( + } +} +pub mod product_group { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_product( &self, resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - tag_id: impl Into, subscription_id: impl Into, - ) -> get_entity_state_by_product::Builder { - get_entity_state_by_product::Builder { + ) -> list_by_product::Builder { + list_by_product::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), - } - } - 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, - scope: None, - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - tag_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(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - tag_id: impl Into, - parameters: impl Into, + product_id: impl Into, + group_id: 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(), - tag_id: tag_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - tag_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - tag_id: tag_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), + product_id: product_id.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -14474,31 +22513,33 @@ pub mod tag { &self, resource_group_name: impl Into, service_name: impl Into, - tag_id: impl Into, - if_match: impl Into, + product_id: impl Into, + group_id: 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(), - tag_id: tag_id.into(), - if_match: if_match.into(), + product_id: product_id.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } - pub fn get_entity_state( + pub fn check_entity_exists( &self, resource_group_name: impl Into, service_name: impl Into, - tag_id: impl Into, + product_id: impl Into, + group_id: impl Into, subscription_id: impl Into, - ) -> get_entity_state::Builder { - get_entity_state::Builder { + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - tag_id: tag_id.into(), + product_id: product_id.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -14551,10 +22592,10 @@ pub mod tag { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/products/{}/tags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -14588,88 +22629,7 @@ pub mod tag { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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_product { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: String, - pub(crate) tag_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/{}/products/{}/tags/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.tag_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", "2018-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagContract = + let rsp_value: models::GroupCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -14687,12 +22647,12 @@ pub mod tag { } } } - pub mod assign_to_product { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::TagContract), - Ok200(models::TagContract), + Created201(models::GroupContract), + Ok200(models::GroupContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14722,20 +22682,20 @@ pub mod tag { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) tag_id: String, + pub(crate) group_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/{}/products/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.tag_id + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -14755,13 +22715,13 @@ pub mod tag { 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::TagContract = + let rsp_value: models::GroupContract = 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::TagContract = + let rsp_value: models::GroupContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -14779,7 +22739,7 @@ pub mod tag { } } } - pub mod detach_from_product { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { @@ -14814,20 +22774,20 @@ pub mod tag { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) tag_id: String, + pub(crate) group_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/{}/products/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.tag_id + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -14861,7 +22821,7 @@ pub mod tag { } } } - pub mod get_entity_state_by_product { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14891,20 +22851,20 @@ pub mod tag { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) tag_id: String, + pub(crate) group_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/{}/products/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.tag_id + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -14922,7 +22882,7 @@ pub mod tag { let rsp = 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(()), + 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::ErrorResponse = @@ -14937,7 +22897,31 @@ pub mod tag { } } } - pub mod list_by_service { +} +pub mod product_subscriptions { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14966,11 +22950,11 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) product_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, - pub(crate) scope: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -14985,18 +22969,15 @@ pub mod tag { self.skip = Some(skip); self } - pub fn scope(mut self, scope: impl Into) -> Self { - self.scope = Some(scope.into()); - self - } - 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.ApiManagement/service/{}/tags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/subscriptions", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -15017,9 +22998,6 @@ pub mod tag { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } - if let Some(scope) = &self.scope { - url.query_pairs_mut().append_pair("scope", scope); - } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -15028,7 +23006,7 @@ pub mod tag { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagCollection = + let rsp_value: models::SubscriptionCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -15046,7 +23024,101 @@ pub mod tag { } } } - pub mod get { +} +pub mod product_policy { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list_by_product::Builder { + list_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_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, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_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, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_product { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -15075,19 +23147,19 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, + pub(crate) product_id: String, 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.ApiManagement/service/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -15107,7 +23179,7 @@ pub mod tag { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagContract = + let rsp_value: models::PolicyCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -15125,13 +23197,8 @@ pub mod tag { } } } - pub mod create_or_update { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::TagContract), - Ok200(models::TagContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15159,29 +23226,25 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, - pub(crate) parameters: models::TagCreateUpdateParameters, + pub(crate) product_id: String, + pub(crate) policy_id: String, 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> { + 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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15189,27 +23252,17 @@ pub mod tag { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::TagContract = - 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::TagContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -15225,8 +23278,13 @@ pub mod tag { } } } - pub mod update { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15254,25 +23312,31 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, - pub(crate) parameters: models::TagCreateUpdateParameters, - pub(crate) if_match: String, + pub(crate) product_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15280,15 +23344,28 @@ pub mod tag { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2018-06-01-preview"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } 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.header("If-Match", &self.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::NO_CONTENT => Ok(()), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + 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::PolicyContract = + 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 = @@ -15337,7 +23414,8 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, + pub(crate) product_id: String, + pub(crate) policy_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -15345,12 +23423,13 @@ pub mod tag { 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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -15385,7 +23464,7 @@ pub mod tag { } } } - pub mod get_entity_state { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -15414,19 +23493,21 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, + pub(crate) product_id: String, + pub(crate) policy_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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); diff --git a/services/mgmt/apimanagement/src/package_2019_01/operations.rs b/services/mgmt/apimanagement/src/package_2019_01/operations.rs index 9713880d9b..23603967b3 100644 --- a/services/mgmt/apimanagement/src/package_2019_01/operations.rs +++ b/services/mgmt/apimanagement/src/package_2019_01/operations.rs @@ -77,9 +77,21 @@ impl Client { pub fn api(&self) -> api::Client { api::Client(self.clone()) } + pub fn api_diagnostic(&self) -> api_diagnostic::Client { + api_diagnostic::Client(self.clone()) + } pub fn api_export(&self) -> api_export::Client { api_export::Client(self.clone()) } + pub fn api_issue(&self) -> api_issue::Client { + api_issue::Client(self.clone()) + } + pub fn api_issue_attachment(&self) -> api_issue_attachment::Client { + api_issue_attachment::Client(self.clone()) + } + pub fn api_issue_comment(&self) -> api_issue_comment::Client { + api_issue_comment::Client(self.clone()) + } pub fn api_management_operations(&self) -> api_management_operations::Client { api_management_operations::Client(self.clone()) } @@ -89,6 +101,30 @@ impl Client { pub fn api_management_service_skus(&self) -> api_management_service_skus::Client { api_management_service_skus::Client(self.clone()) } + pub fn api_operation(&self) -> api_operation::Client { + api_operation::Client(self.clone()) + } + pub fn api_operation_policy(&self) -> api_operation_policy::Client { + api_operation_policy::Client(self.clone()) + } + pub fn api_policy(&self) -> api_policy::Client { + api_policy::Client(self.clone()) + } + pub fn api_product(&self) -> api_product::Client { + api_product::Client(self.clone()) + } + pub fn api_release(&self) -> api_release::Client { + api_release::Client(self.clone()) + } + pub fn api_revision(&self) -> api_revision::Client { + api_revision::Client(self.clone()) + } + pub fn api_schema(&self) -> api_schema::Client { + api_schema::Client(self.clone()) + } + pub fn api_tag_description(&self) -> api_tag_description::Client { + api_tag_description::Client(self.clone()) + } pub fn api_version_set(&self) -> api_version_set::Client { api_version_set::Client(self.clone()) } @@ -143,6 +179,9 @@ impl Client { pub fn open_id_connect_provider(&self) -> open_id_connect_provider::Client { open_id_connect_provider::Client(self.clone()) } + pub fn operation(&self) -> operation::Client { + operation::Client(self.clone()) + } pub fn policy(&self) -> policy::Client { policy::Client(self.clone()) } @@ -226,6 +265,152 @@ pub enum Error { #[error(transparent)] ApiExport_Get(#[from] api_export::get::Error), #[error(transparent)] + Api_ListByService(#[from] api::list_by_service::Error), + #[error(transparent)] + Api_Get(#[from] api::get::Error), + #[error(transparent)] + Api_CreateOrUpdate(#[from] api::create_or_update::Error), + #[error(transparent)] + Api_Update(#[from] api::update::Error), + #[error(transparent)] + Api_Delete(#[from] api::delete::Error), + #[error(transparent)] + Api_GetEntityTag(#[from] api::get_entity_tag::Error), + #[error(transparent)] + ApiRevision_ListByService(#[from] api_revision::list_by_service::Error), + #[error(transparent)] + ApiRelease_ListByService(#[from] api_release::list_by_service::Error), + #[error(transparent)] + ApiRelease_Get(#[from] api_release::get::Error), + #[error(transparent)] + ApiRelease_CreateOrUpdate(#[from] api_release::create_or_update::Error), + #[error(transparent)] + ApiRelease_Update(#[from] api_release::update::Error), + #[error(transparent)] + ApiRelease_Delete(#[from] api_release::delete::Error), + #[error(transparent)] + ApiRelease_GetEntityTag(#[from] api_release::get_entity_tag::Error), + #[error(transparent)] + ApiOperation_ListByApi(#[from] api_operation::list_by_api::Error), + #[error(transparent)] + ApiOperation_Get(#[from] api_operation::get::Error), + #[error(transparent)] + ApiOperation_CreateOrUpdate(#[from] api_operation::create_or_update::Error), + #[error(transparent)] + ApiOperation_Update(#[from] api_operation::update::Error), + #[error(transparent)] + ApiOperation_Delete(#[from] api_operation::delete::Error), + #[error(transparent)] + ApiOperation_GetEntityTag(#[from] api_operation::get_entity_tag::Error), + #[error(transparent)] + ApiOperationPolicy_ListByOperation(#[from] api_operation_policy::list_by_operation::Error), + #[error(transparent)] + ApiOperationPolicy_Get(#[from] api_operation_policy::get::Error), + #[error(transparent)] + ApiOperationPolicy_CreateOrUpdate(#[from] api_operation_policy::create_or_update::Error), + #[error(transparent)] + ApiOperationPolicy_Delete(#[from] api_operation_policy::delete::Error), + #[error(transparent)] + ApiOperationPolicy_GetEntityTag(#[from] api_operation_policy::get_entity_tag::Error), + #[error(transparent)] + Tag_ListByOperation(#[from] tag::list_by_operation::Error), + #[error(transparent)] + Tag_GetByOperation(#[from] tag::get_by_operation::Error), + #[error(transparent)] + Tag_AssignToOperation(#[from] tag::assign_to_operation::Error), + #[error(transparent)] + Tag_DetachFromOperation(#[from] tag::detach_from_operation::Error), + #[error(transparent)] + Tag_GetEntityStateByOperation(#[from] tag::get_entity_state_by_operation::Error), + #[error(transparent)] + ApiProduct_ListByApis(#[from] api_product::list_by_apis::Error), + #[error(transparent)] + ApiPolicy_ListByApi(#[from] api_policy::list_by_api::Error), + #[error(transparent)] + ApiPolicy_Get(#[from] api_policy::get::Error), + #[error(transparent)] + ApiPolicy_CreateOrUpdate(#[from] api_policy::create_or_update::Error), + #[error(transparent)] + ApiPolicy_Delete(#[from] api_policy::delete::Error), + #[error(transparent)] + ApiPolicy_GetEntityTag(#[from] api_policy::get_entity_tag::Error), + #[error(transparent)] + ApiSchema_ListByApi(#[from] api_schema::list_by_api::Error), + #[error(transparent)] + ApiSchema_Get(#[from] api_schema::get::Error), + #[error(transparent)] + ApiSchema_CreateOrUpdate(#[from] api_schema::create_or_update::Error), + #[error(transparent)] + ApiSchema_Delete(#[from] api_schema::delete::Error), + #[error(transparent)] + ApiSchema_GetEntityTag(#[from] api_schema::get_entity_tag::Error), + #[error(transparent)] + ApiDiagnostic_ListByService(#[from] api_diagnostic::list_by_service::Error), + #[error(transparent)] + ApiDiagnostic_Get(#[from] api_diagnostic::get::Error), + #[error(transparent)] + ApiDiagnostic_CreateOrUpdate(#[from] api_diagnostic::create_or_update::Error), + #[error(transparent)] + ApiDiagnostic_Update(#[from] api_diagnostic::update::Error), + #[error(transparent)] + ApiDiagnostic_Delete(#[from] api_diagnostic::delete::Error), + #[error(transparent)] + ApiDiagnostic_GetEntityTag(#[from] api_diagnostic::get_entity_tag::Error), + #[error(transparent)] + ApiIssue_ListByService(#[from] api_issue::list_by_service::Error), + #[error(transparent)] + ApiIssue_Get(#[from] api_issue::get::Error), + #[error(transparent)] + ApiIssue_CreateOrUpdate(#[from] api_issue::create_or_update::Error), + #[error(transparent)] + ApiIssue_Update(#[from] api_issue::update::Error), + #[error(transparent)] + ApiIssue_Delete(#[from] api_issue::delete::Error), + #[error(transparent)] + ApiIssue_GetEntityTag(#[from] api_issue::get_entity_tag::Error), + #[error(transparent)] + ApiIssueComment_ListByService(#[from] api_issue_comment::list_by_service::Error), + #[error(transparent)] + ApiIssueComment_Get(#[from] api_issue_comment::get::Error), + #[error(transparent)] + ApiIssueComment_CreateOrUpdate(#[from] api_issue_comment::create_or_update::Error), + #[error(transparent)] + ApiIssueComment_Delete(#[from] api_issue_comment::delete::Error), + #[error(transparent)] + ApiIssueComment_GetEntityTag(#[from] api_issue_comment::get_entity_tag::Error), + #[error(transparent)] + ApiIssueAttachment_ListByService(#[from] api_issue_attachment::list_by_service::Error), + #[error(transparent)] + ApiIssueAttachment_Get(#[from] api_issue_attachment::get::Error), + #[error(transparent)] + ApiIssueAttachment_CreateOrUpdate(#[from] api_issue_attachment::create_or_update::Error), + #[error(transparent)] + ApiIssueAttachment_Delete(#[from] api_issue_attachment::delete::Error), + #[error(transparent)] + ApiIssueAttachment_GetEntityTag(#[from] api_issue_attachment::get_entity_tag::Error), + #[error(transparent)] + ApiTagDescription_ListByService(#[from] api_tag_description::list_by_service::Error), + #[error(transparent)] + ApiTagDescription_Get(#[from] api_tag_description::get::Error), + #[error(transparent)] + ApiTagDescription_CreateOrUpdate(#[from] api_tag_description::create_or_update::Error), + #[error(transparent)] + ApiTagDescription_Delete(#[from] api_tag_description::delete::Error), + #[error(transparent)] + ApiTagDescription_GetEntityTag(#[from] api_tag_description::get_entity_tag::Error), + #[error(transparent)] + Tag_ListByApi(#[from] tag::list_by_api::Error), + #[error(transparent)] + Tag_GetByApi(#[from] tag::get_by_api::Error), + #[error(transparent)] + Tag_AssignToApi(#[from] tag::assign_to_api::Error), + #[error(transparent)] + Tag_DetachFromApi(#[from] tag::detach_from_api::Error), + #[error(transparent)] + Tag_GetEntityStateByApi(#[from] tag::get_entity_state_by_api::Error), + #[error(transparent)] + Operation_ListByTags(#[from] operation::list_by_tags::Error), + #[error(transparent)] Api_ListByTags(#[from] api::list_by_tags::Error), #[error(transparent)] ApiVersionSet_ListByService(#[from] api_version_set::list_by_service::Error), @@ -742,6 +927,109 @@ pub mod api { use super::models; 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, + tags: None, + expand_api_version_set: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + delete_revisions: None, + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } pub fn list_by_tags( &self, resource_group_name: impl Into, @@ -760,7 +1048,7 @@ pub mod api { } } } - pub mod list_by_tags { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -793,7 +1081,8 @@ pub mod api { pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, - pub(crate) include_not_tagged_apis: Option, + pub(crate) tags: Option, + pub(crate) expand_api_version_set: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -808,14 +1097,18 @@ pub mod api { self.skip = Some(skip); self } - pub fn include_not_tagged_apis(mut self, include_not_tagged_apis: bool) -> Self { - self.include_not_tagged_apis = Some(include_not_tagged_apis); + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.into()); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn expand_api_version_set(mut self, expand_api_version_set: bool) -> Self { + self.expand_api_version_set = Some(expand_api_version_set); + 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/{}/apisByTags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -840,9 +1133,12 @@ pub mod api { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } - if let Some(include_not_tagged_apis) = &self.include_not_tagged_apis { + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } + if let Some(expand_api_version_set) = &self.expand_api_version_set { url.query_pairs_mut() - .append_pair("includeNotTaggedApis", &include_not_tagged_apis.to_string()); + .append_pair("expandApiVersionSet", &expand_api_version_set.to_string()); } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); @@ -852,7 +1148,7 @@ pub mod api { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagResourceCollection = + let rsp_value: models::ApiCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -870,255 +1166,48 @@ pub mod api { } } } -} -pub mod api_version_set { - use super::models; - 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, - version_set_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(), - version_set_id: version_set_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - version_set_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(), - version_set_id: version_set_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - version_set_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - version_set_id: version_set_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - version_set_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(), - version_set_id: version_set_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, - version_set_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(), - version_set_id: version_set_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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/{}/apiVersionSets", - 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", "2019-01-01"); - 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::ApiVersionSetCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_id: String, + pub(crate) api_id: String, 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.ApiManagement/service/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1138,7 +1227,7 @@ pub mod api_version_set { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiVersionSetContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1160,8 +1249,9 @@ pub mod api_version_set { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::ApiVersionSetContract), - Ok200(models::ApiVersionSetContract), + Created201(models::ApiContract), + Accepted202, + Ok200(models::ApiContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1190,8 +1280,8 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, - pub(crate) parameters: models::ApiVersionSetContract, + pub(crate) api_id: String, + pub(crate) parameters: models::ApiCreateOrUpdateParameter, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -1203,12 +1293,12 @@ pub mod api_version_set { 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/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1232,13 +1322,14 @@ pub mod api_version_set { 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::ApiVersionSetContract = + let rsp_value: models::ApiContract = 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), http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiVersionSetContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -1285,8 +1376,8 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, - pub(crate) parameters: models::ApiVersionSetUpdateParameters, + pub(crate) api_id: String, + pub(crate) parameters: models::ApiUpdateContract, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -1294,12 +1385,12 @@ pub mod api_version_set { 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/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1368,20 +1459,25 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, + pub(crate) api_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) delete_revisions: Option, } impl Builder { + pub fn delete_revisions(mut self, delete_revisions: bool) -> Self { + self.delete_revisions = Some(delete_revisions); + 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/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1393,6 +1489,9 @@ pub mod api_version_set { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); + if let Some(delete_revisions) = &self.delete_revisions { + url.query_pairs_mut().append_pair("deleteRevisions", &delete_revisions.to_string()); + } 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()); @@ -1445,19 +1544,19 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, + pub(crate) api_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/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1490,113 +1589,7 @@ pub mod api_version_set { } } } -} -pub mod authorization_server { - use super::models; - 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, - authsid: 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(), - authsid: authsid.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: 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(), - authsid: authsid.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - authsid: authsid.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: 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(), - authsid: authsid.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, - authsid: 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(), - authsid: authsid.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod list_by_tags { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1629,6 +1622,7 @@ pub mod authorization_server { pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, + pub(crate) include_not_tagged_apis: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -1643,12 +1637,14 @@ pub mod authorization_server { self.skip = Some(skip); self } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn include_not_tagged_apis(mut self, include_not_tagged_apis: bool) -> Self { + self.include_not_tagged_apis = Some(include_not_tagged_apis); + 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/{}/authorizationServers", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apisByTags", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -1673,6 +1669,10 @@ pub mod authorization_server { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } + if let Some(include_not_tagged_apis) = &self.include_not_tagged_apis { + url.query_pairs_mut() + .append_pair("includeNotTaggedApis", &include_not_tagged_apis.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)?; @@ -1681,7 +1681,7 @@ pub mod authorization_server { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerCollection = + let rsp_value: models::TagResourceCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1699,7 +1699,31 @@ pub mod authorization_server { } } } - pub mod get { +} +pub mod api_revision { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1728,21 +1752,34 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, + pub(crate) api_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/revisions", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1754,6 +1791,15 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); + 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)?; @@ -1762,7 +1808,7 @@ pub mod authorization_server { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerContract = + let rsp_value: models::ApiRevisionCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1780,63 +1826,185 @@ pub mod authorization_server { } } } - pub mod create_or_update { - use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::AuthorizationServerContract), - Ok200(models::AuthorizationServerContract), - } - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) authsid: String, - pub(crate) parameters: models::AuthorizationServerContract, - pub(crate) subscription_id: String, - pub(crate) if_match: Option, +} +pub mod api_release { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } } - impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); - self + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_id.into(), + subscription_id: subscription_id.into(), } - 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/{}/authorizationServers/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.authsid + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + release_id: release_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_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, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/releases", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -1844,27 +2012,26 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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); + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerContract = - 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::AuthorizationServerContract = + let rsp_value: models::ApiReleaseCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -1880,7 +2047,7 @@ pub mod authorization_server { } } } - pub mod update { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1909,25 +2076,25 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, - pub(crate) parameters: models::AuthorizationServerUpdateContract, - pub(crate) if_match: String, + pub(crate) api_id: String, + pub(crate) release_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -1935,15 +2102,18 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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.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::NO_CONTENT => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiReleaseContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -1958,12 +2128,12 @@ pub mod authorization_server { } } } - pub mod delete { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200, - NoContent204, + Created201(models::ApiReleaseContract), + Ok200(models::ApiReleaseContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1992,24 +2162,31 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, - pub(crate) if_match: String, + pub(crate) api_id: String, + pub(crate) release_id: String, + pub(crate) parameters: models::ApiReleaseContract, 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2017,15 +2194,28 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - req_builder = req_builder.header("If-Match", &self.if_match); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiReleaseContract = + 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::ApiReleaseContract = + 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 = @@ -2040,7 +2230,7 @@ pub mod authorization_server { } } } - pub mod get_entity_tag { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2069,23 +2259,27 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, + pub(crate) api_id: String, + pub(crate) release_id: String, + pub(crate) parameters: models::ApiReleaseContract, + pub(crate) if_match: 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2093,13 +2287,15 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => Ok(()), + 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::ErrorResponse = @@ -2114,39 +2310,204 @@ pub mod authorization_server { } } } -} -pub mod backend { - use super::models; - 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 mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - backend_id: impl Into, - subscription_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) release_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/{}/apis/{}/releases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.release_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", "2019-01-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) release_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/{}/apis/{}/releases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.release_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_operation { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), service_name: service_name.into(), - backend_id: backend_id.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + tags: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + operation_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(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), } } @@ -2154,15 +2515,17 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_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(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -2172,8 +2535,9 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -2181,7 +2545,8 @@ pub mod backend { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), @@ -2191,7 +2556,8 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, + api_id: impl Into, + operation_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -2199,7 +2565,8 @@ pub mod backend { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -2208,35 +2575,21 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, + api_id: impl Into, + operation_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(), - backend_id: backend_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn reconnect( - &self, - resource_group_name: impl Into, - service_name: impl Into, - backend_id: impl Into, - subscription_id: impl Into, - ) -> reconnect::Builder { - reconnect::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), - parameters: None, } } } - pub mod list_by_service { + pub mod list_by_api { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2265,10 +2618,12 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) api_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, + pub(crate) tags: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -2283,14 +2638,19 @@ pub mod backend { self.skip = Some(skip); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.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/{}/backends", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2311,6 +2671,9 @@ pub mod backend { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -2319,7 +2682,7 @@ pub mod backend { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackendCollection = + let rsp_value: models::OperationCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2366,19 +2729,21 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, 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.ApiManagement/service/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2398,7 +2763,7 @@ pub mod backend { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackendContract = + let rsp_value: models::OperationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2420,8 +2785,8 @@ pub mod backend { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::BackendContract), - Ok200(models::BackendContract), + Created201(models::OperationContract), + Ok200(models::OperationContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2450,8 +2815,9 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, - pub(crate) parameters: models::BackendContract, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) parameters: models::OperationContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -2463,12 +2829,13 @@ pub mod backend { 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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2492,13 +2859,13 @@ pub mod backend { 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::BackendContract = + let rsp_value: models::OperationContract = 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::BackendContract = + let rsp_value: models::OperationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -2545,8 +2912,9 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, - pub(crate) parameters: models::BackendUpdateParameters, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) parameters: models::OperationUpdateContract, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -2554,12 +2922,13 @@ pub mod backend { 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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2628,7 +2997,8 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -2636,12 +3006,13 @@ pub mod backend { 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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2705,19 +3076,21 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, + pub(crate) api_id: String, + pub(crate) operation_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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2750,167 +3123,77 @@ pub mod backend { } } } - pub mod reconnect { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) backend_id: 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<(), Error>> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}/reconnect", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.backend_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", "2019-01-01"); - 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::ACCEPTED => 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 cache { +pub mod api_operation_policy { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_service( + pub fn list_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> list_by_operation::Builder { + list_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), - top: None, - skip: None, } } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_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(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), + format: None, } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_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(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, } } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - cache_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - cache_id: cache_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -2918,7 +3201,9 @@ pub mod cache { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -2927,19 +3212,23 @@ pub mod cache { &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_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(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_service { + pub mod list_by_operation { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2968,27 +3257,21 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, pub(crate) subscription_id: String, - pub(crate) top: Option, - pub(crate) skip: Option, } impl Builder { - 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> { + 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/{}/caches", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -3000,12 +3283,6 @@ pub mod cache { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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)?; @@ -3014,7 +3291,7 @@ pub mod cache { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CacheCollection = + let rsp_value: models::PolicyCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -3061,20 +3338,20 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_id: String, pub(crate) subscription_id: String, + pub(crate) format: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3085,6 +3362,9 @@ pub mod cache { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -3093,7 +3373,7 @@ pub mod cache { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CacheContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -3115,8 +3395,8 @@ pub mod cache { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::CacheContract), - Ok200(models::CacheContract), + Created201(models::PolicyContract), + Ok200(models::PolicyContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3145,8 +3425,10 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, - pub(crate) parameters: models::CacheContract, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -3157,14 +3439,7 @@ pub mod cache { } 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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3187,13 +3462,13 @@ pub mod cache { 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::CacheContract = + let rsp_value: models::PolicyContract = 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::CacheContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -3211,8 +3486,13 @@ pub mod cache { } } } - pub mod update { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -3240,25 +3520,19 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, - pub(crate) parameters: models::CacheUpdateParameters, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_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<(), Error>> { + 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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -3266,15 +3540,15 @@ pub mod cache { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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.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::NO_CONTENT => Ok(()), + 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 = @@ -3289,13 +3563,8 @@ pub mod cache { } } } - pub mod delete { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -3323,20 +3592,7668 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, - pub(crate) if_match: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_id: String, 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<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 tag { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_operation( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, + subscription_id: impl Into, + ) -> list_by_operation::Builder { + list_by_operation::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get_by_operation( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_by_operation::Builder { + get_by_operation::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn assign_to_operation( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> assign_to_operation::Builder { + assign_to_operation::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn detach_from_operation( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> detach_from_operation::Builder { + detach_from_operation::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state_by_operation( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state_by_operation::Builder { + get_entity_state_by_operation::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_by_api::Builder { + get_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn assign_to_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> assign_to_api::Builder { + assign_to_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn detach_from_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> detach_from_api::Builder { + detach_from_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state_by_api::Builder { + get_entity_state_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list_by_product::Builder { + list_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_by_product::Builder { + get_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn assign_to_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> assign_to_product::Builder { + assign_to_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn detach_from_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> detach_from_product::Builder { + detach_from_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state_by_product::Builder { + get_entity_state_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + 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, + scope: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_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(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_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(), + tag_id: tag_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + tag_id: tag_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_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(), + tag_id: tag_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state::Builder { + get_entity_state::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: 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/{}/apis/{}/operations/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2019-01-01"); + 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::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 assign_to_operation { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TagContract = + 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::TagContract = + 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 detach_from_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_state_by_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2019-01-01"); + 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::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 assign_to_api { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TagContract = + 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::TagContract = + 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 detach_from_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_state_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_by_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: 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/{}/products/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_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", "2019-01-01"); + 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::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 assign_to_product { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TagContract = + 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::TagContract = + 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 detach_from_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_state_by_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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, + pub(crate) scope: 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 scope(mut self, scope: impl Into) -> Self { + self.scope = Some(scope.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/{}/tags", + 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", "2019-01-01"); + 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()); + } + if let Some(scope) = &self.scope { + url.query_pairs_mut().append_pair("scope", scope); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_id: String, + pub(crate) parameters: models::TagCreateUpdateParameters, + 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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2019-01-01"); + 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::TagContract = + 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::TagContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_id: String, + pub(crate) parameters: models::TagCreateUpdateParameters, + pub(crate) if_match: 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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2019-01-01"); + 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.header("If-Match", &self.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::NO_CONTENT => 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2019-01-01"); + 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_state { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_product { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_apis( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_apis::Builder { + list_by_apis::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list_by_apis { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/products", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2019-01-01"); + 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::ProductCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 api_policy { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + format: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_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, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_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, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_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/{}/apis/{}/policies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match 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)?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_id: String, + pub(crate) subscription_id: String, + pub(crate) format: Option, + } + impl Builder { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2019-01-01"); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, + 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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2019-01-01"); + 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::PolicyContract = + 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::PolicyContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2019-01-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_schema { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.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, + api_id: 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(), + api_id: api_id.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, + api_id: 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(), + api_id: api_id.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, + api_id: 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(), + api_id: api_id.into(), + schema_id: schema_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + force: None, + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + schema_id: schema_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/schemas", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2019-01-01"); + 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::SchemaCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SchemaContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::SchemaContract), + Ok200(models::SchemaContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) schema_id: String, + pub(crate) parameters: models::SchemaCreateOrUpdateContract, + 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2019-01-01"); + 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::SchemaContract = + 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::SchemaContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) schema_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + pub(crate) force: Option, + } + impl Builder { + pub fn force(mut self, force: bool) -> Self { + self.force = Some(force); + 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2019-01-01"); + if let Some(force) = &self.force { + url.query_pairs_mut().append_pair("force", &force.to_string()); + } + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_diagnostic { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.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, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_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, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/diagnostics", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2019-01-01"); + 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::DiagnosticCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::DiagnosticContract), + Ok200(models::DiagnosticContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + 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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2019-01-01"); + 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::DiagnosticContract = + 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::DiagnosticContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + pub(crate) if_match: 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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2019-01-01"); + 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.header("If-Match", &self.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::NO_CONTENT => 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2019-01-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_issue { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + expand_comments_attachments: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + expand_comments_attachments: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + issue_id: issue_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_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, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) expand_comments_attachments: 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 expand_comments_attachments(mut self, expand_comments_attachments: bool) -> Self { + self.expand_comments_attachments = Some(expand_comments_attachments); + 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/{}/apis/{}/issues", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2019-01-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(expand_comments_attachments) = &self.expand_comments_attachments { + url.query_pairs_mut() + .append_pair("expandCommentsAttachments", &expand_comments_attachments.to_string()); + } + 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::IssueCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) subscription_id: String, + pub(crate) expand_comments_attachments: Option, + } + impl Builder { + pub fn expand_comments_attachments(mut self, expand_comments_attachments: bool) -> Self { + self.expand_comments_attachments = Some(expand_comments_attachments); + 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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2019-01-01"); + if let Some(expand_comments_attachments) = &self.expand_comments_attachments { + url.query_pairs_mut() + .append_pair("expandCommentsAttachments", &expand_comments_attachments.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::IssueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueContract), + Ok200(models::IssueContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) parameters: models::IssueContract, + 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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2019-01-01"); + 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::IssueContract = + 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::IssueContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) parameters: models::IssueUpdateContract, + pub(crate) if_match: 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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2019-01-01"); + 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.header("If-Match", &self.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::NO_CONTENT => 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2019-01-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_issue_comment { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: 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(), + api_id: api_id.into(), + issue_id: issue_id.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, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_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, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_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, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: 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/{}/apis/{}/issues/{}/comments", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2019-01-01"); + 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::IssueCommentCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueCommentContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueCommentContract), + Ok200(models::IssueCommentContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_id: String, + pub(crate) parameters: models::IssueCommentContract, + 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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2019-01-01"); + 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::IssueCommentContract = + 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::IssueCommentContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2019-01-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_issue_attachment { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: 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(), + api_id: api_id.into(), + issue_id: issue_id.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, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_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, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_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, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: 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/{}/apis/{}/issues/{}/attachments", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2019-01-01"); + 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::IssueAttachmentCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueAttachmentContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueAttachmentContract), + Ok200(models::IssueAttachmentContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_id: String, + pub(crate) parameters: models::IssueAttachmentContract, + 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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2019-01-01"); + 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::IssueAttachmentContract = + 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::IssueAttachmentContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2019-01-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_tag_description { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.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, + api_id: impl Into, + tag_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(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_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(), + api_id: api_id.into(), + tag_id: tag_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, + api_id: impl Into, + tag_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(), + api_id: api_id.into(), + tag_id: tag_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, + api_id: impl Into, + tag_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(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/tagDescriptions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2019-01-01"); + 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::TagDescriptionCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagDescriptionContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::TagDescriptionContract), + Ok200(models::TagDescriptionContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_id: String, + pub(crate) parameters: models::TagDescriptionCreateParameters, + 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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2019-01-01"); + 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::TagDescriptionContract = + 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::TagDescriptionContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2019-01-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 operation { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_tags( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_tags::Builder { + list_by_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + include_not_tagged_operations: None, + } + } + } + pub mod list_by_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) include_not_tagged_operations: 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 include_not_tagged_operations(mut self, include_not_tagged_operations: bool) -> Self { + self.include_not_tagged_operations = Some(include_not_tagged_operations); + 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/{}/apis/{}/operationsByTags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2019-01-01"); + 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()); + } + if let Some(include_not_tagged_operations) = &self.include_not_tagged_operations { + url.query_pairs_mut() + .append_pair("includeNotTaggedOperations", &include_not_tagged_operations.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::TagResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod api_version_set { + use super::models; + 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, + version_set_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(), + version_set_id: version_set_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_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(), + version_set_id: version_set_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + version_set_id: version_set_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_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(), + version_set_id: version_set_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, + version_set_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(), + version_set_id: version_set_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/apiVersionSets", + 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", "2019-01-01"); + 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::ApiVersionSetCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiVersionSetContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::ApiVersionSetContract), + Ok200(models::ApiVersionSetContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_id: String, + pub(crate) parameters: models::ApiVersionSetContract, + 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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2019-01-01"); + 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::ApiVersionSetContract = + 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::ApiVersionSetContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_id: String, + pub(crate) parameters: models::ApiVersionSetUpdateParameters, + pub(crate) if_match: 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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2019-01-01"); + 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.header("If-Match", &self.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::NO_CONTENT => 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2019-01-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 authorization_server { + use super::models; + 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, + authsid: 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(), + authsid: authsid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: 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(), + authsid: authsid.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + authsid: authsid.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: 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(), + authsid: authsid.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, + authsid: 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(), + authsid: authsid.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/authorizationServers", + 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", "2019-01-01"); + 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::AuthorizationServerCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationServerContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::AuthorizationServerContract), + Ok200(models::AuthorizationServerContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: String, + pub(crate) parameters: models::AuthorizationServerContract, + 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/{}/caches/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/authorizationServers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.cache_id + &self.authsid + ); + let mut url = 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", "2019-01-01"); + 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::AuthorizationServerContract = + 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::AuthorizationServerContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: String, + pub(crate) parameters: models::AuthorizationServerUpdateContract, + pub(crate) if_match: 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2019-01-01"); + 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.header("If-Match", &self.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::NO_CONTENT => 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -3400,19 +11317,19 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, + pub(crate) authsid: 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/{}/caches/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/authorizationServers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.cache_id + &self.authsid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -3446,7 +11363,7 @@ pub mod cache { } } } -pub mod certificate { +pub mod backend { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -3470,14 +11387,14 @@ pub mod certificate { &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, + backend_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(), - certificate_id: certificate_id.into(), + backend_id: backend_id.into(), subscription_id: subscription_id.into(), } } @@ -3485,25 +11402,44 @@ pub mod certificate { &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, - parameters: impl Into, + backend_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(), - certificate_id: certificate_id.into(), + backend_id: backend_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, } } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + backend_id: backend_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, + backend_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -3511,7 +11447,7 @@ pub mod certificate { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), + backend_id: backend_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -3520,15 +11456,31 @@ pub mod certificate { &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, + backend_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(), - certificate_id: certificate_id.into(), + backend_id: backend_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn reconnect( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_id: impl Into, + subscription_id: impl Into, + ) -> reconnect::Builder { + reconnect::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + backend_id: backend_id.into(), subscription_id: subscription_id.into(), + parameters: None, } } } @@ -3579,10 +11531,10 @@ pub mod certificate { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/certificates", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -3615,7 +11567,7 @@ pub mod certificate { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CertificateCollection = + let rsp_value: models::BackendCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -3662,19 +11614,19 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, + pub(crate) backend_id: String, 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.ApiManagement/service/{}/certificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.certificate_id + &self.backend_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -3694,7 +11646,7 @@ pub mod certificate { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CertificateContract = + let rsp_value: models::BackendContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -3716,8 +11668,8 @@ pub mod certificate { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::CertificateContract), - Ok200(models::CertificateContract), + Created201(models::BackendContract), + Ok200(models::BackendContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3746,8 +11698,8 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, - pub(crate) parameters: models::CertificateCreateOrUpdateParameters, + pub(crate) backend_id: String, + pub(crate) parameters: models::BackendContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -3759,12 +11711,12 @@ pub mod certificate { 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/{}/certificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.certificate_id + &self.backend_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -3788,13 +11740,13 @@ pub mod certificate { 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::CertificateContract = + let rsp_value: models::BackendContract = 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::CertificateContract = + let rsp_value: models::BackendContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -3812,13 +11764,8 @@ pub mod certificate { } } } - pub mod delete { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -3846,24 +11793,25 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, + pub(crate) backend_id: String, + pub(crate) parameters: models::BackendUpdateParameters, pub(crate) if_match: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.certificate_id + &self.backend_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -3871,15 +11819,15 @@ pub mod certificate { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); + 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.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), + 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::ErrorResponse = @@ -3894,8 +11842,13 @@ pub mod certificate { } } } - pub mod get_entity_tag { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -3923,23 +11876,24 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, + pub(crate) backend_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<(), Error>> { + 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/{}/certificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.certificate_id + &self.backend_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -3947,13 +11901,15 @@ pub mod certificate { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); + 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(()), + 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 = @@ -3968,21 +11924,15 @@ pub mod certificate { } } } -} -pub mod api_management_operations { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list(&self) -> list::Builder { - list::Builder { client: self.0.clone() } - } - } - pub mod list { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -4001,14 +11951,25 @@ pub mod api_management_operations { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) backend_id: String, + 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<(), Error>> { Box::pin(async move { - let url_str = &format!("{}/providers/Microsoft.ApiManagement/operations", self.client.endpoint(),); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.backend_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4022,17 +11983,14 @@ pub mod api_management_operations { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match 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) - } + http::StatusCode::OK => Ok(()), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { + 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, - body: rsp_body, + value: rsp_value, }) } } @@ -4040,32 +11998,15 @@ pub mod api_management_operations { } } } -} -pub mod api_management_service_skus { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Gets available SKUs for API Management service"] - pub fn list_available_service_skus( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> list_available_service_skus::Builder { - list_available_service_skus::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_available_service_skus { + pub mod reconnect { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -4086,21 +12027,28 @@ pub mod api_management_service_skus { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) backend_id: String, pub(crate) subscription_id: String, + pub(crate) parameters: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/skus", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}/reconnect", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.backend_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4108,23 +12056,25 @@ pub mod api_management_service_skus { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - let req_body = azure_core::EMPTY_BODY; + 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::ResourceSkuResults = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + http::StatusCode::ACCEPTED => Ok(()), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { + 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, - body: rsp_body, + value: rsp_value, }) } } @@ -4133,50 +12083,37 @@ pub mod api_management_service_skus { } } } -pub mod api_management_service { +pub mod cache { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn restore( - &self, - resource_group_name: impl Into, - service_name: impl Into, - parameters: impl Into, - subscription_id: impl Into, - ) -> restore::Builder { - restore::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn backup( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, subscription_id: impl Into, - ) -> backup::Builder { - backup::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - parameters: parameters.into(), subscription_id: subscription_id.into(), + top: None, + skip: None, } } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, + cache_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(), + cache_id: cache_id.into(), subscription_id: subscription_id.into(), } } @@ -4184,112 +12121,81 @@ pub mod api_management_service { &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + cache_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(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_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(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: 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(), - 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 { + create_or_update::Builder { client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + cache_id: cache_id.into(), + parameters: parameters.into(), subscription_id: subscription_id.into(), + if_match: None, } } - pub fn get_sso_token( + pub fn update( &self, resource_group_name: impl Into, service_name: impl Into, + cache_id: impl Into, + parameters: impl Into, + if_match: impl Into, subscription_id: impl Into, - ) -> get_sso_token::Builder { - get_sso_token::Builder { + ) -> update::Builder { + update::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + cache_id: cache_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } - pub fn check_name_availability( + pub fn delete( &self, - parameters: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + cache_id: impl Into, + if_match: impl Into, subscription_id: impl Into, - ) -> check_name_availability::Builder { - check_name_availability::Builder { + ) -> delete::Builder { + delete::Builder { client: self.0.clone(), - parameters: parameters.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + cache_id: cache_id.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } - pub fn apply_network_configuration_updates( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, + cache_id: impl Into, subscription_id: impl Into, - ) -> apply_network_configuration_updates::Builder { - apply_network_configuration_updates::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + cache_id: cache_id.into(), subscription_id: subscription_id.into(), - parameters: None, } } } - pub mod restore { + pub mod list_by_service { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, - } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -4310,14 +12216,23 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/restore", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -4325,7 +12240,7 @@ pub mod api_management_service { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4333,8 +12248,13 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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(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)?; @@ -4342,16 +12262,17 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = + let rsp_value: models::CacheCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(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 { + 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, - body: rsp_body, + value: rsp_value, }) } } @@ -4359,17 +12280,15 @@ pub mod api_management_service { } } } - pub mod backup { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, - } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -4390,22 +12309,23 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, + pub(crate) cache_id: String, 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.ApiManagement/service/{}/backup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.cache_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4413,8 +12333,7 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -4422,16 +12341,17 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = + let rsp_value: models::CacheContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(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 { + 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, - body: rsp_body, + value: rsp_value, }) } } @@ -4439,12 +12359,20 @@ pub mod api_management_service { } } } - pub mod get { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::CacheContract), + Ok200(models::CacheContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -4465,23 +12393,29 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) cache_id: String, + pub(crate) parameters: models::CacheContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.cache_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4489,23 +12423,35 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - let req_body = azure_core::EMPTY_BODY; + 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::CacheContract = + 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::ApiManagementServiceResource = + let rsp_value: models::CacheContract = 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)?; - Err(Error::UnexpectedResponse { + 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, - body: rsp_body, + value: rsp_value, }) } } @@ -4513,18 +12459,15 @@ pub mod api_management_service { } } } - pub mod create_or_update { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ApiManagementServiceResource), - Created201(models::ApiManagementServiceResource), - Accepted202, - } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -4545,22 +12488,25 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceResource, + pub(crate) cache_id: String, + pub(crate) parameters: models::CacheUpdateParameters, + pub(crate) if_match: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.cache_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4570,29 +12516,20 @@ pub mod api_management_service { url.query_pairs_mut().append_pair("api-version", "2019-01-01"); 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.header("If-Match", &self.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::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = - 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::ApiManagementServiceResource = - 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), + 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 { + 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, - body: rsp_body, + value: rsp_value, }) } } @@ -4600,17 +12537,20 @@ pub mod api_management_service { } } } - pub mod update { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, + 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("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -4631,22 +12571,24 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceUpdateParameters, + pub(crate) cache_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/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.cache_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4654,25 +12596,22 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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.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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = - 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::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 { + 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, - body: rsp_body, + value: rsp_value, }) } } @@ -4680,18 +12619,15 @@ pub mod api_management_service { } } } - pub mod delete { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202(models::ApiManagementServiceResource), - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -4712,21 +12648,23 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) cache_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.cache_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4740,19 +12678,14 @@ pub mod api_management_service { let rsp = 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::ApiManagementServiceResource = - 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), + http::StatusCode::OK => Ok(()), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { + 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, - body: rsp_body, + value: rsp_value, }) } } @@ -4760,12 +12693,102 @@ pub mod api_management_service { } } } - pub mod list_by_resource_group { +} +pub mod certificate { + use super::models; + 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, + certificate_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(), + certificate_id: certificate_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + certificate_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(), + certificate_id: certificate_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, + certificate_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(), + certificate_id: certificate_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, + certificate_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(), + certificate_id: certificate_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -4785,18 +12808,33 @@ pub mod api_management_service { 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 into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + 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", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates", self.client.endpoint(), &self.subscription_id, - &self.resource_group_name + &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(); @@ -4808,6 +12846,15 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); + 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)?; @@ -4816,15 +12863,17 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceListResult = + let rsp_value: models::CertificateCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { + 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, - body: rsp_body, + value: rsp_value, }) } } @@ -4832,12 +12881,15 @@ pub mod api_management_service { } } } - pub mod list { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -4856,17 +12908,21 @@ pub mod api_management_service { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) certificate_id: String, 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.ApiManagement/service", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", self.client.endpoint(), - &self.subscription_id + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -4886,15 +12942,17 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceListResult = + let rsp_value: models::CertificateContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { + 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, - body: rsp_body, + value: rsp_value, }) } } @@ -4902,12 +12960,20 @@ pub mod api_management_service { } } } - pub mod get_sso_token { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::CertificateContract), + Ok200(models::CertificateContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -4928,24 +12994,29 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) certificate_id: String, + pub(crate) parameters: models::CertificateCreateOrUpdateParameters, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> - { + 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/{}/getssotoken", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.certificate_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4953,24 +13024,35 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + 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::CertificateContract = + 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::ApiManagementServiceGetSsoTokenResult = + let rsp_value: models::CertificateContract = 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)?; - Err(Error::UnexpectedResponse { + 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, - body: rsp_body, + value: rsp_value, }) } } @@ -4978,12 +13060,20 @@ pub mod api_management_service { } } } - pub mod check_name_availability { + pub mod delete { use super::models; + #[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("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -5002,23 +13092,26 @@ pub mod api_management_service { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) parameters: models::ApiManagementServiceCheckNameAvailabilityParameters, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) certificate_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> - { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.ApiManagement/checkNameAvailability", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", self.client.endpoint(), - &self.subscription_id + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5026,24 +13119,22 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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.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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceNameAvailabilityResult = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 { + 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, - body: rsp_body, + value: rsp_value, }) } } @@ -5051,17 +13142,15 @@ pub mod api_management_service { } } } - pub mod apply_network_configuration_updates { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Ok200(models::ApiManagementServiceResource), - } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -5082,20 +13171,23 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) certificate_id: 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> { + 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/{}/applynetworkconfigurationupdates" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5103,29 +13195,20 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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 - }; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ApiManagementServiceResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + http::StatusCode::OK => Ok(()), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - Err(Error::UnexpectedResponse { + 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, - body: rsp_body, + value: rsp_value, }) } } @@ -5134,120 +13217,20 @@ pub mod api_management_service { } } } -pub mod diagnostic { +pub mod api_management_operations { use super::models; 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, - diagnostic_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(), - diagnostic_id: diagnostic_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - diagnostic_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(), - diagnostic_id: diagnostic_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - diagnostic_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - diagnostic_id: diagnostic_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - diagnostic_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(), - diagnostic_id: diagnostic_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, - diagnostic_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(), - diagnostic_id: diagnostic_id.into(), - subscription_id: subscription_id.into(), - } + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } } } - pub mod list_by_service { + pub mod list { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -5264,37 +13247,13 @@ pub mod diagnostic { Deserialize(#[source] 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, + pub struct Builder { + pub(crate) client: super::super::Client, } 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> { + 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/{}/diagnostics", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = &format!("{}/providers/Microsoft.ApiManagement/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); @@ -5305,15 +13264,6 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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)?; @@ -5322,17 +13272,15 @@ pub mod diagnostic { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DiagnosticCollection = + 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 { + Err(Error::UnexpectedResponse { status_code, - value: rsp_value, + body: rsp_body, }) } } @@ -5340,15 +13288,32 @@ pub mod diagnostic { } } } - pub mod get { +} +pub mod api_management_service_skus { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets available SKUs for API Management service"] + pub fn list_available_service_skus( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_available_service_skus::Builder { + list_available_service_skus::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_available_service_skus { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -5369,19 +13334,17 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, 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.ApiManagement/service/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/skus", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &self.service_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -5401,17 +13364,15 @@ pub mod diagnostic { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DiagnosticContract = + let rsp_value: models::ResourceSkuResults = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; 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 { + Err(Error::UnexpectedResponse { status_code, - value: rsp_value, + body: rsp_body, }) } } @@ -5419,20 +13380,164 @@ pub mod diagnostic { } } } - pub mod create_or_update { +} +pub mod api_management_service { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn restore( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> restore::Builder { + restore::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn backup( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> backup::Builder { + backup::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: 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(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + 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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: 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(), + 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 fn get_sso_token( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> get_sso_token::Builder { + get_sso_token::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + 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 apply_network_configuration_updates( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> apply_network_configuration_updates::Builder { + apply_network_configuration_updates::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + } + pub mod restore { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::DiagnosticContract), - Ok200(models::DiagnosticContract), + Ok200(models::ApiManagementServiceResource), + Accepted202, } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -5453,29 +13558,22 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, - pub(crate) parameters: models::DiagnosticContract, + pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, 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/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/restore", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5485,33 +13583,23 @@ pub mod diagnostic { url.query_pairs_mut().append_pair("api-version", "2019-01-01"); 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::DiagnosticContract = - 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::DiagnosticContract = + let rsp_value: models::ApiManagementServiceResource = 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 { + Err(Error::UnexpectedResponse { status_code, - value: rsp_value, + body: rsp_body, }) } } @@ -5519,15 +13607,17 @@ pub mod diagnostic { } } } - pub mod update { + pub mod backup { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -5548,25 +13638,22 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, - pub(crate) parameters: models::DiagnosticContract, - pub(crate) if_match: String, + pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backup", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5576,20 +13663,23 @@ pub mod diagnostic { url.query_pairs_mut().append_pair("api-version", "2019-01-01"); 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.header("If-Match", &self.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::NO_CONTENT => Ok(()), - status_code => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ErrorResponse = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { + 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, - value: rsp_value, + body: rsp_body, }) } } @@ -5597,20 +13687,12 @@ pub mod diagnostic { } } } - pub mod delete { + pub mod get { use super::models; - #[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("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -5631,24 +13713,23 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_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> { + 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/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5656,22 +13737,23 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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 => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ErrorResponse = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { status_code, - value: rsp_value, + body: rsp_body, }) } } @@ -5679,15 +13761,18 @@ pub mod diagnostic { } } } - pub mod get_entity_tag { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Created201(models::ApiManagementServiceResource), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -5708,23 +13793,22 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, + pub(crate) parameters: models::ApiManagementServiceResource, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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::HEAD); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5732,142 +13816,49 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - let req_body = azure_core::EMPTY_BODY; + 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 => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ErrorResponse = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) + Ok(Response::Ok200(rsp_value)) } - } - }) - } - } - } -} -pub mod email_template { - use super::models; - 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, - template_name: 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(), - template_name: template_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - template_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(), - service_name: service_name.into(), - template_name: template_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - template_name: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - template_name: template_name.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - template_name: 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(), - template_name: template_name.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, - template_name: 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(), - template_name: template_name.into(), - subscription_id: subscription_id.into(), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceResource = + 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)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) } } } - pub mod list_by_service { + pub mod update { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -5888,28 +13879,14 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) parameters: models::ApiManagementServiceUpdateParameters, 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> { + 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/{}/templates", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -5917,7 +13894,7 @@ pub mod email_template { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5925,16 +13902,8 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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.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)?; @@ -5942,17 +13911,16 @@ pub mod email_template { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateCollection = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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 { + Err(Error::UnexpectedResponse { status_code, - value: rsp_value, + body: rsp_body, }) } } @@ -5960,15 +13928,18 @@ pub mod email_template { } } } - pub mod get { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::ApiManagementServiceResource), + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -5989,23 +13960,21 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, 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.ApiManagement/service/{}/templates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.template_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6019,19 +13988,19 @@ pub mod email_template { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { + 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::EmailTemplateContract = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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 { + Err(Error::UnexpectedResponse { status_code, - value: rsp_value, + body: rsp_body, }) } } @@ -6039,20 +14008,12 @@ pub mod email_template { } } } - pub mod create_or_update { + pub mod list_by_resource_group { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::EmailTemplateContract), - Ok200(models::EmailTemplateContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -6072,30 +14033,22 @@ pub mod email_template { pub struct Builder { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) template_name: String, - pub(crate) parameters: models::EmailTemplateUpdateParameters, 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> { + 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/{}/templates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service", self.client.endpoint(), &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.template_name + &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::PUT); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6103,35 +14056,93 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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 => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateContract = + let rsp_value: models::ApiManagementServiceListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Created201(rsp_value)) + Ok(rsp_value) + } + status_code => { + let 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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.ApiManagement/service", + 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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateContract = + let rsp_value: models::ApiManagementServiceListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + 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 { + Err(Error::UnexpectedResponse { status_code, - value: rsp_value, + body: rsp_body, }) } } @@ -6139,15 +14150,12 @@ pub mod email_template { } } } - pub mod update { + pub mod get_sso_token { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -6168,25 +14176,24 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, - pub(crate) parameters: models::EmailTemplateUpdateParameters, - pub(crate) if_match: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/templates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/getssotoken", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.template_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6194,22 +14201,24 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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.header("If-Match", &self.if_match); + 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 => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ErrorResponse = + let rsp_value: models::ApiManagementServiceGetSsoTokenResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { status_code, - value: rsp_value, + body: rsp_body, }) } } @@ -6217,20 +14226,12 @@ pub mod email_template { } } } - pub mod delete { + pub mod check_name_availability { use super::models; - #[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("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -6249,26 +14250,23 @@ pub mod email_template { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) template_name: String, - pub(crate) if_match: String, + pub(crate) parameters: models::ApiManagementServiceCheckNameAvailabilityParameters, 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.ApiManagement/service/{}/templates/{}", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/checkNameAvailability", self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.template_name + &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::DELETE); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6276,22 +14274,24 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - req_builder = req_builder.header("If-Match", &self.if_match); - let req_body = azure_core::EMPTY_BODY; + 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::NO_CONTENT => Ok(Response::NoContent204), - status_code => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ErrorResponse = + let rsp_value: models::ApiManagementServiceNameAvailabilityResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { status_code, - value: rsp_value, + body: rsp_body, }) } } @@ -6299,15 +14299,17 @@ pub mod email_template { } } } - pub mod get_entity_tag { + pub mod apply_network_configuration_updates { use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ApiManagementServiceResource), + } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -6328,23 +14330,20 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, pub(crate) subscription_id: String, + pub(crate) parameters: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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.ApiManagement/service/{}/templates/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.template_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/applynetworkconfigurationupdates" , 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::HEAD); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6352,20 +14351,29 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - let req_body = azure_core::EMPTY_BODY; + 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(()), - status_code => { + 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::ErrorResponse = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { status_code, - value: rsp_value, + body: rsp_body, }) } } @@ -6374,7 +14382,7 @@ pub mod email_template { } } } -pub mod group { +pub mod diagnostic { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -6398,14 +14406,14 @@ pub mod group { &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, + diagnostic_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(), - group_id: group_id.into(), + diagnostic_id: diagnostic_id.into(), subscription_id: subscription_id.into(), } } @@ -6413,15 +14421,15 @@ pub mod group { &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - parameters: impl Into, + diagnostic_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(), - group_id: group_id.into(), + diagnostic_id: diagnostic_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -6431,8 +14439,8 @@ pub mod group { &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - parameters: impl Into, + diagnostic_id: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -6440,7 +14448,7 @@ pub mod group { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - group_id: group_id.into(), + diagnostic_id: diagnostic_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), @@ -6450,7 +14458,7 @@ pub mod group { &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, + diagnostic_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -6458,7 +14466,7 @@ pub mod group { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - group_id: group_id.into(), + diagnostic_id: diagnostic_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -6467,14 +14475,14 @@ pub mod group { &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, + diagnostic_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(), - group_id: group_id.into(), + diagnostic_id: diagnostic_id.into(), subscription_id: subscription_id.into(), } } @@ -6526,10 +14534,10 @@ pub mod group { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/groups", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -6562,7 +14570,7 @@ pub mod group { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GroupCollection = + let rsp_value: models::DiagnosticCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -6609,19 +14617,19 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, + pub(crate) diagnostic_id: String, 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.ApiManagement/service/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.diagnostic_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -6641,7 +14649,7 @@ pub mod group { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GroupContract = + let rsp_value: models::DiagnosticContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -6663,8 +14671,8 @@ pub mod group { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::GroupContract), - Ok200(models::GroupContract), + Created201(models::DiagnosticContract), + Ok200(models::DiagnosticContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6693,8 +14701,8 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) parameters: models::GroupCreateParameters, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -6706,12 +14714,12 @@ pub mod group { 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/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.diagnostic_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -6735,13 +14743,13 @@ pub mod group { 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::GroupContract = + let rsp_value: models::DiagnosticContract = 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::GroupContract = + let rsp_value: models::DiagnosticContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -6788,8 +14796,8 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) parameters: models::GroupUpdateParameters, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -6797,12 +14805,12 @@ pub mod group { 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/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.diagnostic_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -6871,7 +14879,7 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, + pub(crate) diagnostic_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -6879,12 +14887,12 @@ pub mod group { 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/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.diagnostic_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -6948,19 +14956,19 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, + pub(crate) diagnostic_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/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.diagnostic_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -6994,42 +15002,75 @@ pub mod group { } } } -pub mod group_user { +pub mod email_template { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, subscription_id: impl Into, - ) -> list::Builder { - list::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - group_id: group_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, } } - pub fn create( + pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - user_id: impl Into, + template_name: impl Into, subscription_id: impl Into, - ) -> create::Builder { - create::Builder { + ) -> get::Builder { + get::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - group_id: group_id.into(), - user_id: user_id.into(), + template_name: template_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + template_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(), + service_name: service_name.into(), + template_name: template_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + template_name: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + template_name: template_name.into(), + parameters: parameters.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } @@ -7037,38 +15078,36 @@ pub mod group_user { &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - user_id: impl Into, + template_name: 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(), - group_id: group_id.into(), - user_id: user_id.into(), + template_name: template_name.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } - pub fn check_entity_exists( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - user_id: impl Into, + template_name: impl Into, subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - group_id: group_id.into(), - user_id: user_id.into(), + template_name: template_name.into(), subscription_id: subscription_id.into(), } } } - pub mod list { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7097,7 +15136,6 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, @@ -7116,15 +15154,14 @@ pub mod group_user { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/groups/{}/users", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.group_id + &self.service_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -7153,7 +15190,7 @@ pub mod group_user { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::UserCollection = + let rsp_value: models::EmailTemplateCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -7171,13 +15208,8 @@ pub mod group_user { } } } - pub mod create { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::UserContract), - Ok200(models::UserContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7205,25 +15237,23 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) user_id: String, + pub(crate) template_name: String, 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.ApiManagement/service/{}/groups/{}/users/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id, - &self.user_id + &self.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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7237,17 +15267,11 @@ pub mod group_user { let 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::UserContract = - 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::UserContract = + let rsp_value: models::EmailTemplateContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -7263,12 +15287,12 @@ pub mod group_user { } } } - pub mod delete { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200, - NoContent204, + Created201(models::EmailTemplateContract), + Ok200(models::EmailTemplateContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7297,25 +15321,29 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) user_id: String, + pub(crate) template_name: String, + pub(crate) parameters: models::EmailTemplateUpdateParameters, 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/{}/groups/{}/users/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id, - &self.user_id + &self.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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7323,14 +15351,28 @@ pub mod group_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EmailTemplateContract = + 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::EmailTemplateContract = + 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 = @@ -7345,12 +15387,10 @@ pub mod group_user { } } } - pub mod check_entity_exists { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Error response #response_type")] - NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -7376,159 +15416,62 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) user_id: String, + pub(crate) template_name: String, + pub(crate) parameters: models::EmailTemplateUpdateParameters, + pub(crate) if_match: 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/{}/groups/{}/users/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id, - &self.user_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", "2019-01-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let 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(()), - http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), - 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 identity_provider { - use super::models; - 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(), - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - identity_provider_name: 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(), - identity_provider_name: identity_provider_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - identity_provider_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(), - service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - identity_provider_name: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - identity_provider_name: 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(), - identity_provider_name: identity_provider_name.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, - identity_provider_name: 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(), - identity_provider_name: identity_provider_name.into(), - subscription_id: subscription_id.into(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.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", "2019-01-01"); + 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.header("If-Match", &self.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::NO_CONTENT => 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_by_service { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7556,21 +15499,24 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) template_name: 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> { + 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/{}/identityProviders", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7578,18 +15524,15 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IdentityProviderList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -7604,7 +15547,7 @@ pub mod identity_provider { } } } - pub mod get { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7633,23 +15576,23 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, + pub(crate) template_name: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7663,12 +15606,7 @@ pub mod identity_provider { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IdentityProviderContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -7683,13 +15621,114 @@ pub mod identity_provider { } } } - pub mod create_or_update { - use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::IdentityProviderContract), - Ok200(models::IdentityProviderContract), +} +pub mod group { + use super::models; + 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, + group_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(), + group_id: group_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_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(), + group_id: group_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_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(), + group_id: group_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, + group_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(), + group_id: group_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7717,29 +15756,36 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, - pub(crate) parameters: models::IdentityProviderContract, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + 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> { + 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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.identity_provider_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7747,27 +15793,26 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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); + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IdentityProviderContract = - 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::IdentityProviderContract = + let rsp_value: models::GroupCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -7783,7 +15828,7 @@ pub mod identity_provider { } } } - pub mod update { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7812,25 +15857,23 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, - pub(crate) parameters: models::IdentityProviderUpdateParameters, - pub(crate) if_match: String, + pub(crate) group_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.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::PATCH); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7838,15 +15881,18 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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.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::NO_CONTENT => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GroupContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -7861,12 +15907,12 @@ pub mod identity_provider { } } } - pub mod delete { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200, - NoContent204, + Created201(models::GroupContract), + Ok200(models::GroupContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7895,24 +15941,29 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, - pub(crate) if_match: String, + pub(crate) group_id: String, + pub(crate) parameters: models::GroupCreateParameters, 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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.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::DELETE); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7920,15 +15971,28 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - req_builder = req_builder.header("If-Match", &self.if_match); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GroupContract = + 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::GroupContract = + 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 = @@ -7943,7 +16007,7 @@ pub mod identity_provider { } } } - pub mod get_entity_tag { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7972,23 +16036,25 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, + pub(crate) group_id: String, + pub(crate) parameters: models::GroupUpdateParameters, + pub(crate) if_match: 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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.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::HEAD); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7996,13 +16062,15 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => Ok(()), + 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::ErrorResponse = @@ -8017,45 +16085,13 @@ pub mod identity_provider { } } } -} -pub mod issue { - use super::models; - 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, - issue_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(), - issue_id: issue_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8083,36 +16119,24 @@ pub mod issue { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) group_id: String, + pub(crate) if_match: 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> { + 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/{}/issues", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8120,27 +16144,15 @@ pub mod issue { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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()); - } + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IssueCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -8155,7 +16167,7 @@ pub mod issue { } } } - pub mod get { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8184,23 +16196,23 @@ pub mod issue { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) issue_id: String, + pub(crate) group_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/issues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.issue_id + &self.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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8214,12 +16226,7 @@ pub mod issue { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IssueContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -8235,75 +16242,42 @@ pub mod issue { } } } -pub mod logger { +pub mod group_user { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_service( + pub fn list( &self, resource_group_name: impl Into, service_name: impl Into, + group_id: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> list::Builder { + list::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + group_id: group_id.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, - logger_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(), - logger_id: logger_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - logger_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(), - logger_id: logger_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( + pub fn create( &self, resource_group_name: impl Into, service_name: impl Into, - logger_id: impl Into, - parameters: impl Into, - if_match: impl Into, + group_id: impl Into, + user_id: impl Into, subscription_id: impl Into, - ) -> update::Builder { - update::Builder { + ) -> create::Builder { + create::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - logger_id: logger_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), + group_id: group_id.into(), + user_id: user_id.into(), subscription_id: subscription_id.into(), } } @@ -8311,37 +16285,38 @@ pub mod logger { &self, resource_group_name: impl Into, service_name: impl Into, - logger_id: impl Into, - if_match: impl Into, + group_id: impl Into, + user_id: 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(), - logger_id: logger_id.into(), - if_match: if_match.into(), + group_id: group_id.into(), + user_id: user_id.into(), subscription_id: subscription_id.into(), - force: None, } } - pub fn get_entity_tag( + pub fn check_entity_exists( &self, resource_group_name: impl Into, service_name: impl Into, - logger_id: impl Into, - subscription_id: impl Into, - ) -> get_entity_tag::Builder { - get_entity_tag::Builder { + group_id: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - logger_id: logger_id.into(), + group_id: group_id.into(), + user_id: user_id.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_service { + pub mod list { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8370,6 +16345,7 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) group_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, @@ -8388,14 +16364,15 @@ pub mod logger { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/loggers", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -8424,7 +16401,7 @@ pub mod logger { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::LoggerCollection = + let rsp_value: models::UserCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -8442,8 +16419,13 @@ pub mod logger { } } } - pub mod get { + pub mod create { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::UserContract), + Ok200(models::UserContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8471,23 +16453,25 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, + pub(crate) group_id: String, + pub(crate) user_id: String, 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.ApiManagement/service/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.group_id, + &self.user_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8501,11 +16485,17 @@ pub mod logger { let 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::UserContract = + 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::LoggerContract = + let rsp_value: models::UserContract = 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)?; @@ -8521,12 +16511,12 @@ pub mod logger { } } } - pub mod create_or_update { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::LoggerContract), - Ok200(models::LoggerContract), + Ok200, + NoContent204, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8555,29 +16545,25 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, - pub(crate) parameters: models::LoggerContract, + pub(crate) group_id: String, + pub(crate) user_id: String, 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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.group_id, + &self.user_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8585,28 +16571,93 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::LoggerContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Created201(rsp_value)) - } - http::StatusCode::OK => { + 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::LoggerContract = + let rsp_value: models::ErrorResponse = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) } + } + }) + } + } + } + pub mod check_entity_exists { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) group_id: String, + pub(crate) user_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/{}/groups/{}/users/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.group_id, + &self.user_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -8621,7 +16672,110 @@ pub mod logger { } } } - pub mod update { +} +pub mod identity_provider { + use super::models; + 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(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + identity_provider_name: 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(), + identity_provider_name: identity_provider_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + identity_provider_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(), + service_name: service_name.into(), + identity_provider_name: identity_provider_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + identity_provider_name: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + identity_provider_name: identity_provider_name.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + identity_provider_name: 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(), + identity_provider_name: identity_provider_name.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, + identity_provider_name: 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(), + identity_provider_name: identity_provider_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8650,25 +16804,21 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, - pub(crate) parameters: models::LoggerUpdateContract, - pub(crate) if_match: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.logger_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8676,15 +16826,18 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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.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::NO_CONTENT => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IdentityProviderList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -8699,13 +16852,8 @@ pub mod logger { } } } - pub mod delete { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8733,29 +16881,23 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, - pub(crate) if_match: String, + pub(crate) identity_provider_name: String, pub(crate) subscription_id: String, - pub(crate) force: Option, } impl Builder { - pub fn force(mut self, force: bool) -> Self { - self.force = Some(force); - self - } - 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.ApiManagement/service/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.identity_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8763,18 +16905,18 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - req_builder = req_builder.header("If-Match", &self.if_match); - if let Some(force) = &self.force { - url.query_pairs_mut().append_pair("force", &force.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::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IdentityProviderContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -8789,8 +16931,13 @@ pub mod logger { } } } - pub mod get_entity_tag { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::IdentityProviderContract), + Ok200(models::IdentityProviderContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8818,23 +16965,29 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, + pub(crate) identity_provider_name: String, + pub(crate) parameters: models::IdentityProviderContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.identity_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::HEAD); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8842,13 +16995,28 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(()), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IdentityProviderContract = + 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::IdentityProviderContract = + 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 = @@ -8863,41 +17031,7 @@ pub mod logger { } } } -} -pub mod network_status { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_service( - &self, - subscription_id: impl Into, - resource_group_name: impl Into, - service_name: impl Into, - ) -> list_by_service::Builder { - list_by_service::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_by_location( - &self, - subscription_id: impl Into, - resource_group_name: impl Into, - service_name: impl Into, - location_name: impl Into, - ) -> list_by_location::Builder { - list_by_location::Builder { - client: self.0.clone(), - subscription_id: subscription_id.into(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - location_name: location_name.into(), - } - } - } - pub mod list_by_service { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8924,25 +17058,27 @@ pub mod network_status { #[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) identity_provider_name: String, + pub(crate) parameters: models::IdentityProviderUpdateParameters, + pub(crate) if_match: String, + pub(crate) subscription_id: String, } impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + 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/{}/networkstatus", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.identity_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8950,18 +17086,15 @@ pub mod network_status { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::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) - } + 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::ErrorResponse = @@ -8976,8 +17109,13 @@ pub mod network_status { } } } - pub mod list_by_location { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9003,25 +17141,26 @@ pub mod network_status { #[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) location_name: String, + pub(crate) identity_provider_name: 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> { + 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/{}/locations/{}/networkstatus", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.location_name + &self.identity_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9029,18 +17168,15 @@ pub mod network_status { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NetworkStatusContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -9055,59 +17191,7 @@ pub mod network_status { } } } -} -pub mod notification { - use super::models; - 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(), - top: None, - skip: None, - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: 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(), - notification_name: notification_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_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(), - service_name: service_name.into(), - notification_name: notification_name.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - } - pub mod list_by_service { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9136,31 +17220,23 @@ pub mod notification { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) identity_provider_name: String, pub(crate) subscription_id: String, - pub(crate) top: Option, - pub(crate) skip: Option, } impl Builder { - 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> { + 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/{}/notifications", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.identity_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9168,24 +17244,13 @@ pub mod notification { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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::NotificationCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -9200,7 +17265,44 @@ pub mod notification { } } } - pub mod get { +} +pub mod issue { + use super::models; + 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, + issue_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(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9229,19 +17331,32 @@ pub mod notification { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/notifications/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/issues", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.notification_name + &self.service_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -9253,6 +17368,15 @@ pub mod notification { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); + 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)?; @@ -9261,7 +17385,7 @@ pub mod notification { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NotificationContract = + let rsp_value: models::IssueCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -9279,7 +17403,7 @@ pub mod notification { } } } - pub mod create_or_update { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9308,28 +17432,23 @@ pub mod notification { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, + pub(crate) issue_id: String, 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> { + 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/{}/notifications/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/issues/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.notification_name + &self.issue_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9337,9 +17456,6 @@ pub mod notification { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - if let Some(if_match) = &self.if_match { - req_builder = req_builder.header("If-Match", 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)?; @@ -9348,7 +17464,7 @@ pub mod notification { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NotificationContract = + let rsp_value: models::IssueContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -9367,22 +17483,38 @@ pub mod notification { } } } -pub mod notification_recipient_user { +pub mod logger { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_notification( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - notification_name: impl Into, subscription_id: impl Into, - ) -> list_by_notification::Builder { - list_by_notification::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - notification_name: notification_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, + logger_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(), + logger_id: logger_id.into(), subscription_id: subscription_id.into(), } } @@ -9390,16 +17522,36 @@ pub mod notification_recipient_user { &self, resource_group_name: impl Into, service_name: impl Into, - notification_name: impl Into, - user_id: impl Into, + logger_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(), - notification_name: notification_name.into(), - user_id: user_id.into(), + logger_id: logger_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + logger_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + logger_id: logger_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } @@ -9407,38 +17559,37 @@ pub mod notification_recipient_user { &self, resource_group_name: impl Into, service_name: impl Into, - notification_name: impl Into, - user_id: impl Into, + logger_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(), - notification_name: notification_name.into(), - user_id: user_id.into(), + logger_id: logger_id.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), + force: None, } } - pub fn check_entity_exists( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, - notification_name: impl Into, - user_id: impl Into, + logger_id: impl Into, subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - notification_name: notification_name.into(), - user_id: user_id.into(), + logger_id: logger_id.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_notification { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9467,13 +17618,33 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/notifications/{}/recipientUsers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers", + 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); @@ -9484,6 +17655,15 @@ pub mod notification_recipient_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); + 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)?; @@ -9492,7 +17672,7 @@ pub mod notification_recipient_user { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientUserCollection = + let rsp_value: models::LoggerCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -9505,18 +17685,13 @@ pub mod notification_recipient_user { value: rsp_value, }) } - } - }) - } - } - } - pub mod create_or_update { - use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::RecipientUserContract), - Ok200(models::RecipientUserContract), + } + }) + } } + } + pub mod get { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9544,17 +17719,23 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) user_id: String, + pub(crate) logger_id: String, 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.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.logger_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9568,17 +17749,11 @@ pub mod notification_recipient_user { let 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::RecipientUserContract = - 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::RecipientUserContract = + let rsp_value: models::LoggerContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -9594,12 +17769,12 @@ pub mod notification_recipient_user { } } } - pub mod delete { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200, - NoContent204, + Created201(models::LoggerContract), + Ok200(models::LoggerContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9628,17 +17803,29 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) user_id: String, + pub(crate) logger_id: String, + pub(crate) parameters: models::LoggerContract, 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/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.logger_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9646,14 +17833,28 @@ pub mod notification_recipient_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoggerContract = + 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::LoggerContract = + 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 = @@ -9668,12 +17869,10 @@ pub mod notification_recipient_user { } } } - pub mod check_entity_exists { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Error response #response_type")] - NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -9699,17 +17898,25 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) user_id: String, + pub(crate) logger_id: String, + pub(crate) parameters: models::LoggerUpdateContract, + pub(crate) if_match: 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/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.logger_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9717,14 +17924,15 @@ pub mod notification_recipient_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::NO_CONTENT => Ok(()), - http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -9739,80 +17947,13 @@ pub mod notification_recipient_user { } } } -} -pub mod notification_recipient_email { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_notification( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - subscription_id: impl Into, - ) -> list_by_notification::Builder { - list_by_notification::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - notification_name: notification_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - email: 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(), - notification_name: notification_name.into(), - email: email.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - email: 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(), - notification_name: notification_name.into(), - email: email.into(), - subscription_id: subscription_id.into(), - } - } - pub fn check_entity_exists( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - email: impl Into, - subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - notification_name: notification_name.into(), - email: email.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_notification { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9840,16 +17981,29 @@ pub mod notification_recipient_email { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, + pub(crate) logger_id: String, + pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) force: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn force(mut self, force: bool) -> Self { + self.force = Some(force); + 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/{}/notifications/{}/recipientEmails" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.logger_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9857,18 +18011,18 @@ pub mod notification_recipient_email { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); + req_builder = req_builder.header("If-Match", &self.if_match); + if let Some(force) = &self.force { + url.query_pairs_mut().append_pair("force", &force.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::RecipientEmailCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -9883,13 +18037,8 @@ pub mod notification_recipient_email { } } } - pub mod create_or_update { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::RecipientEmailContract), - Ok200(models::RecipientEmailContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9917,17 +18066,23 @@ pub mod notification_recipient_email { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) email: String, + pub(crate) logger_id: String, 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<(), Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.logger_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9935,24 +18090,13 @@ pub mod notification_recipient_email { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let 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::RecipientEmailContract = - 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::RecipientEmailContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 = @@ -9967,13 +18111,42 @@ pub mod notification_recipient_email { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, +} +pub mod network_status { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> list_by_service::Builder { + list_by_service::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_by_location( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + location_name: impl Into, + ) -> list_by_location::Builder { + list_by_location::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + location_name: location_name.into(), + } } + } + pub mod list_by_service { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9999,19 +18172,25 @@ pub mod notification_recipient_email { #[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) notification_name: String, - pub(crate) email: String, - 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, Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/networkstatus", + 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -10025,8 +18204,12 @@ pub mod notification_recipient_email { let rsp = 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::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::ErrorResponse = @@ -10041,12 +18224,10 @@ pub mod notification_recipient_email { } } } - pub mod check_entity_exists { + pub mod list_by_location { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Error response #response_type")] - NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -10070,19 +18251,25 @@ pub mod notification_recipient_email { #[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) notification_name: String, - pub(crate) email: String, - pub(crate) subscription_id: String, + pub(crate) location_name: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/locations/{}/networkstatus", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.location_name + ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -10096,8 +18283,12 @@ pub mod notification_recipient_email { let 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(()), - http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkStatusContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -10113,7 +18304,7 @@ pub mod notification_recipient_email { } } } -pub mod open_id_connect_provider { +pub mod notification { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -10128,7 +18319,6 @@ pub mod open_id_connect_provider { resource_group_name: resource_group_name.into(), service_name: service_name.into(), subscription_id: subscription_id.into(), - filter: None, top: None, skip: None, } @@ -10137,14 +18327,14 @@ pub mod open_id_connect_provider { &self, resource_group_name: impl Into, service_name: impl Into, - opid: impl Into, + notification_name: 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(), - opid: opid.into(), + notification_name: notification_name.into(), subscription_id: subscription_id.into(), } } @@ -10152,71 +18342,18 @@ pub mod open_id_connect_provider { &self, resource_group_name: impl Into, service_name: impl Into, - opid: impl Into, - parameters: impl Into, + notification_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(), service_name: service_name.into(), - opid: opid.into(), - parameters: parameters.into(), + notification_name: notification_name.into(), subscription_id: subscription_id.into(), if_match: None, } } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - opid: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - opid: opid.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - opid: 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(), - opid: opid.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, - opid: 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(), - opid: opid.into(), - subscription_id: subscription_id.into(), - } - } } pub mod list_by_service { use super::models; @@ -10248,15 +18385,10 @@ pub mod open_id_connect_provider { 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 @@ -10265,16 +18397,99 @@ pub mod open_id_connect_provider { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/notifications", + 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", "2019-01-01"); + 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::NotificationCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) notification_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.ApiManagement/service/{}/openidConnectProviders", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.notification_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -10286,15 +18501,6 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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)?; @@ -10303,7 +18509,7 @@ pub mod open_id_connect_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OpenIdConnectProviderCollection = + let rsp_value: models::NotificationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -10321,7 +18527,7 @@ pub mod open_id_connect_provider { } } } - pub mod get { + pub mod create_or_update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -10350,25 +18556,28 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, + pub(crate) notification_name: String, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/openidConnectProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.opid + &self.notification_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -10376,6 +18585,9 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", 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)?; @@ -10384,7 +18596,7 @@ pub mod open_id_connect_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OpenidConnectProviderContract = + let rsp_value: models::NotificationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -10402,13 +18614,80 @@ pub mod open_id_connect_provider { } } } - pub mod create_or_update { - use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::OpenidConnectProviderContract), - Ok200(models::OpenidConnectProviderContract), +} +pub mod notification_recipient_user { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_notification( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + subscription_id: impl Into, + ) -> list_by_notification::Builder { + list_by_notification::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + user_id: 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(), + notification_name: notification_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + user_id: 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(), + notification_name: notification_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } } + } + pub mod list_by_notification { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -10436,29 +18715,16 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, - pub(crate) parameters: models::OpenidConnectProviderContract, + pub(crate) notification_name: String, 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> { + 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/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -10466,27 +18732,17 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::OpenidConnectProviderContract = - 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::OpenidConnectProviderContract = + let rsp_value: models::RecipientUserCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -10502,8 +18758,13 @@ pub mod open_id_connect_provider { } } } - pub mod update { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::RecipientUserContract), + Ok200(models::RecipientUserContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -10531,25 +18792,17 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, - pub(crate) parameters: models::OpenidConnectProviderUpdateContract, - pub(crate) if_match: String, + pub(crate) notification_name: String, + pub(crate) user_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -10557,15 +18810,24 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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.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::NO_CONTENT => Ok(()), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecipientUserContract = + 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::RecipientUserContract = + 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 = @@ -10614,21 +18876,14 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, - pub(crate) if_match: String, + pub(crate) notification_name: String, + pub(crate) user_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/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_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); @@ -10639,7 +18894,6 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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)?; @@ -10662,10 +18916,12 @@ pub mod open_id_connect_provider { } } } - pub mod get_entity_tag { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -10691,20 +18947,14 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, + pub(crate) notification_name: String, + pub(crate) user_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/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_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); @@ -10721,7 +18971,8 @@ pub mod open_id_connect_provider { let rsp = 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(()), + http::StatusCode::NO_CONTENT => Ok(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -10732,96 +18983,83 @@ pub mod open_id_connect_provider { }) } } - }) - } - } - } -} -pub mod policy { - use super::models; - 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(), + }) } } - pub fn get( + } +} +pub mod notification_recipient_email { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_notification( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, + notification_name: impl Into, subscription_id: impl Into, - ) -> get::Builder { - get::Builder { + ) -> list_by_notification::Builder { + list_by_notification::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - policy_id: policy_id.into(), + notification_name: notification_name.into(), subscription_id: subscription_id.into(), - format: None, } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, - parameters: impl Into, + notification_name: impl Into, + email: 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(), - policy_id: policy_id.into(), - parameters: parameters.into(), + notification_name: notification_name.into(), + email: email.into(), subscription_id: subscription_id.into(), - if_match: None, } } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, - if_match: impl Into, + notification_name: impl Into, + email: 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(), - policy_id: policy_id.into(), - if_match: if_match.into(), + notification_name: notification_name.into(), + email: email.into(), subscription_id: subscription_id.into(), } } - pub fn get_entity_tag( + pub fn check_entity_exists( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, + notification_name: impl Into, + email: impl Into, subscription_id: impl Into, - ) -> get_entity_tag::Builder { - get_entity_tag::Builder { + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - policy_id: policy_id.into(), + notification_name: notification_name.into(), + email: email.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_service { + pub mod list_by_notification { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -10850,18 +19088,13 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) notification_name: String, 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.ApiManagement/service/{}/policies", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::GET); @@ -10880,7 +19113,7 @@ pub mod policy { match 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 = + let rsp_value: models::RecipientEmailCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -10898,8 +19131,13 @@ pub mod policy { } } } - pub mod get { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::RecipientEmailContract), + Ok200(models::RecipientEmailContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -10927,28 +19165,17 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, + pub(crate) notification_name: String, + pub(crate) email: String, pub(crate) subscription_id: String, - pub(crate) format: Option, } impl Builder { - pub fn format(mut self, format: impl Into) -> Self { - self.format = Some(format.into()); - self - } - 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.ApiManagement/service/{}/policies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.policy_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -10956,20 +19183,23 @@ pub mod policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - if let Some(format) = &self.format { - url.query_pairs_mut().append_pair("format", format); - } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::RecipientEmailContract = + 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::PolicyContract = + let rsp_value: models::RecipientEmailContract = 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)?; @@ -10985,12 +19215,12 @@ pub mod policy { } } } - pub mod create_or_update { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::PolicyContract), - Ok200(models::PolicyContract), + Ok200, + NoContent204, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11019,29 +19249,17 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, - pub(crate) parameters: models::PolicyContract, + pub(crate) notification_name: String, + pub(crate) email: String, 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/{}/policies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.policy_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; let mut url = 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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11049,28 +19267,14 @@ pub mod policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::PolicyContract = - 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::PolicyContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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 = @@ -11085,15 +19289,12 @@ pub mod policy { } } } - pub mod delete { + pub mod check_entity_exists { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -11119,24 +19320,17 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, - pub(crate) if_match: String, + pub(crate) notification_name: String, + pub(crate) email: String, 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<(), Error>> { Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.policy_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; let mut url = 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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11144,15 +19338,14 @@ pub mod policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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), + http::StatusCode::NO_CONTENT => Ok(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -11167,7 +19360,113 @@ pub mod policy { } } } - pub mod get_entity_tag { +} +pub mod open_id_connect_provider { + use super::models; + 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, + opid: 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(), + opid: opid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: 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(), + opid: opid.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + opid: opid.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: 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(), + opid: opid.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, + opid: 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(), + opid: opid.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11196,23 +19495,38 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.policy_id + &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::HEAD); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11220,13 +19534,27 @@ pub mod policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); + 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 => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenIdConnectProviderCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -11241,27 +19569,7 @@ pub mod policy { } } } -} -pub mod policy_snippet { - use super::models; - 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(), - scope: None, - } - } - } - pub mod list_by_service { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11290,22 +19598,21 @@ pub mod policy_snippet { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) opid: String, pub(crate) subscription_id: String, - pub(crate) scope: Option, } impl Builder { - pub fn scope(mut self, scope: impl Into) -> Self { - self.scope = Some(scope.into()); - self - } - 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.ApiManagement/service/{}/policySnippets", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.opid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -11317,9 +19624,6 @@ pub mod policy_snippet { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - if let Some(scope) = &self.scope { - url.query_pairs_mut().append_pair("scope", scope); - } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -11328,7 +19632,7 @@ pub mod policy_snippet { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PolicySnippetsCollection = + let rsp_value: models::OpenidConnectProviderContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -11346,73 +19650,13 @@ pub mod policy_snippet { } } } -} -pub mod sign_in_settings { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - resource_group_name: impl Into, - service_name: 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(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - 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(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - parameters: parameters.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, - 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(), - subscription_id: subscription_id.into(), - } - } - } - pub mod get { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::OpenidConnectProviderContract), + Ok200(models::OpenidConnectProviderContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -11440,21 +19684,29 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) opid: String, + pub(crate) parameters: models::OpenidConnectProviderContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.opid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11462,17 +19714,27 @@ pub mod sign_in_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - let req_body = azure_core::EMPTY_BODY; + 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::OpenidConnectProviderContract = + 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::PortalSigninSettings = + let rsp_value: models::OpenidConnectProviderContract = 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)?; @@ -11488,7 +19750,7 @@ pub mod sign_in_settings { } } } - pub mod create_or_update { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11517,27 +19779,25 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSigninSettings, + pub(crate) opid: String, + pub(crate) parameters: models::OpenidConnectProviderUpdateContract, + pub(crate) if_match: String, 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> { + 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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.opid ); let mut url = 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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11547,20 +19807,13 @@ pub mod sign_in_settings { url.query_pairs_mut().append_pair("api-version", "2019-01-01"); 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::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSigninSettings = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + req_builder = req_builder.header("If-Match", &self.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::NO_CONTENT => Ok(()), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -11575,8 +19828,13 @@ pub mod sign_in_settings { } } } - pub mod update { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -11604,23 +19862,24 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSigninSettings, + pub(crate) opid: 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<(), Error>> { + 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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.opid ); let mut url = 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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11628,15 +19887,15 @@ pub mod sign_in_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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.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::NO_CONTENT => Ok(()), + 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 = @@ -11680,17 +19939,19 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) opid: 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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.opid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -11724,52 +19985,70 @@ pub mod sign_in_settings { } } } -pub mod sign_up_settings { +pub mod policy { use super::models; 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(), + } + } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, + policy_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(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), + format: None, } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + policy_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(), + policy_id: policy_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, } } - pub fn update( + pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + policy_id: impl Into, if_match: impl Into, subscription_id: impl Into, - ) -> update::Builder { - update::Builder { + ) -> delete::Builder { + delete::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - parameters: parameters.into(), + policy_id: policy_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -11778,17 +20057,19 @@ pub mod sign_up_settings { &self, resource_group_name: impl Into, service_name: impl Into, + policy_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(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), } } } - pub mod get { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11820,10 +20101,10 @@ pub mod sign_up_settings { 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.ApiManagement/service/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -11847,9 +20128,196 @@ pub mod sign_up_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSignupSettings = + 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)?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) policy_id: String, + pub(crate) subscription_id: String, + pub(crate) format: Option, + } + impl Builder { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.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/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.policy_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", "2019-01-01"); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) policy_id: String, + pub(crate) parameters: models::PolicyContract, + 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/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.policy_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", "2019-01-01"); + 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::PolicyContract = + 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::PolicyContract = 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)?; @@ -11865,8 +20333,13 @@ pub mod sign_up_settings { } } } - pub mod create_or_update { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -11894,27 +20367,24 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSignupSettings, + pub(crate) policy_id: String, + pub(crate) if_match: String, 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> { + 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/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11922,22 +20392,15 @@ pub mod sign_up_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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.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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSignupSettings = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -11952,7 +20415,7 @@ pub mod sign_up_settings { } } } - pub mod update { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11981,23 +20444,23 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSignupSettings, - pub(crate) if_match: String, + pub(crate) policy_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/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12005,15 +20468,13 @@ pub mod sign_up_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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.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::NO_CONTENT => Ok(()), + 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 = @@ -12028,7 +20489,27 @@ pub mod sign_up_settings { } } } - pub mod get_entity_tag { +} +pub mod policy_snippet { + use super::models; + 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(), + scope: None, + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12058,12 +20539,17 @@ pub mod sign_up_settings { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) subscription_id: String, + pub(crate) scope: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + pub fn scope(mut self, scope: impl Into) -> Self { + self.scope = Some(scope.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/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policySnippets", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -12071,7 +20557,7 @@ pub mod sign_up_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12079,13 +20565,21 @@ pub mod sign_up_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); + if let Some(scope) = &self.scope { + url.query_pairs_mut().append_pair("scope", scope); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicySnippetsCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -12101,7 +20595,7 @@ pub mod sign_up_settings { } } } -pub mod delegation_settings { +pub mod sign_in_settings { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -12122,7 +20616,7 @@ pub mod delegation_settings { &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + parameters: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -12138,7 +20632,7 @@ pub mod delegation_settings { &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -12197,10 +20691,10 @@ pub mod delegation_settings { 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.ApiManagement/service/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -12224,7 +20718,7 @@ pub mod delegation_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalDelegationSettings = + let rsp_value: models::PortalSigninSettings = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -12271,7 +20765,7 @@ pub mod delegation_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalDelegationSettings, + pub(crate) parameters: models::PortalSigninSettings, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -12280,10 +20774,10 @@ pub mod delegation_settings { self.if_match = Some(if_match.into()); self } - 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.ApiManagement/service/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -12311,7 +20805,7 @@ pub mod delegation_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalDelegationSettings = + let rsp_value: models::PortalSigninSettings = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -12358,7 +20852,7 @@ pub mod delegation_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalDelegationSettings, + pub(crate) parameters: models::PortalSigninSettings, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -12366,7 +20860,7 @@ pub mod delegation_settings { 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/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -12440,7 +20934,7 @@ pub mod delegation_settings { 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/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -12478,40 +20972,20 @@ pub mod delegation_settings { } } } -pub mod product { +pub mod sign_up_settings { use super::models; 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, - expand_groups: None, - tags: None, - } - } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - product_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(), - product_id: product_id.into(), subscription_id: subscription_id.into(), } } @@ -12519,15 +20993,13 @@ pub mod product { &self, resource_group_name: impl Into, service_name: impl Into, - product_id: impl Into, - parameters: 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(), - product_id: product_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -12537,8 +21009,7 @@ pub mod product { &self, resource_group_name: impl Into, service_name: impl Into, - product_id: impl Into, - parameters: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -12546,64 +21017,103 @@ pub mod product { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - product_id: product_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_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(), - product_id: product_id.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - delete_subscriptions: None, - } - } pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, - product_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(), - product_id: product_id.into(), subscription_id: subscription_id.into(), } } - pub fn list_by_tags( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> list_by_tags::Builder { - list_by_tags::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, - include_not_tagged_products: None, + } + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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, + } + impl Builder { + 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/{}/portalsettings/signup", + 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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalSignupSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_service { + pub mod create_or_update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12632,38 +21142,19 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) parameters: models::PortalSignupSettings, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, - pub(crate) expand_groups: Option, - pub(crate) tags: Option, + pub(crate) if_match: 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 expand_groups(mut self, expand_groups: bool) -> Self { - self.expand_groups = Some(expand_groups); - self - } - pub fn tags(mut self, tags: impl Into) -> Self { - self.tags = Some(tags.into()); + 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> { + 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/{}/products", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -12671,7 +21162,7 @@ pub mod product { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12679,22 +21170,11 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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()); - } - if let Some(expand_groups) = &self.expand_groups { - url.query_pairs_mut().append_pair("expandGroups", &expand_groups.to_string()); - } - if let Some(tags) = &self.tags { - url.query_pairs_mut().append_pair("tags", tags); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -12702,7 +21182,7 @@ pub mod product { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProductCollection = + let rsp_value: models::PortalSignupSettings = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -12720,7 +21200,7 @@ pub mod product { } } } - pub mod get { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12749,23 +21229,23 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, + pub(crate) parameters: models::PortalSignupSettings, + pub(crate) if_match: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12773,18 +21253,15 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProductContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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::ErrorResponse = @@ -12799,13 +21276,8 @@ pub mod product { } } } - pub mod create_or_update { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ProductContract), - Ok200(models::ProductContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12833,29 +21305,21 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) parameters: models::ProductContract, 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> { + 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12863,28 +21327,13 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ProductContract = - 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::ProductContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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 = @@ -12899,7 +21348,72 @@ pub mod product { } } } - pub mod update { +} +pub mod delegation_settings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + service_name: 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(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + 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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.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, + 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(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12928,25 +21442,21 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) parameters: models::ProductUpdateParameters, - pub(crate) if_match: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12954,15 +21464,18 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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.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::NO_CONTENT => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalDelegationSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -12977,13 +21490,8 @@ pub mod product { } } } - pub mod delete { + pub mod create_or_update { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13011,29 +21519,27 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) if_match: String, + pub(crate) parameters: models::PortalDelegationSettings, pub(crate) subscription_id: String, - pub(crate) delete_subscriptions: Option, + pub(crate) if_match: Option, } impl Builder { - pub fn delete_subscriptions(mut self, delete_subscriptions: bool) -> Self { - self.delete_subscriptions = Some(delete_subscriptions); + 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> { + 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13041,19 +21547,22 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - req_builder = req_builder.header("If-Match", &self.if_match); - if let Some(delete_subscriptions) = &self.delete_subscriptions { - url.query_pairs_mut() - .append_pair("deleteSubscriptions", &delete_subscriptions.to_string()); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalDelegationSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -13068,7 +21577,7 @@ pub mod product { } } } - pub mod get_entity_tag { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13097,23 +21606,23 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, + pub(crate) parameters: models::PortalDelegationSettings, + pub(crate) if_match: 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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::HEAD); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13121,13 +21630,15 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => Ok(()), + 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::ErrorResponse = @@ -13142,7 +21653,7 @@ pub mod product { } } } - pub mod list_by_tags { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13172,32 +21683,12 @@ pub mod product { 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, - pub(crate) include_not_tagged_products: 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 include_not_tagged_products(mut self, include_not_tagged_products: bool) -> Self { - self.include_not_tagged_products = Some(include_not_tagged_products); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/productsByTags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -13205,7 +21696,7 @@ pub mod product { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13213,31 +21704,13 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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()); - } - if let Some(include_not_tagged_products) = &self.include_not_tagged_products { - url.query_pairs_mut() - .append_pair("includeNotTaggedProducts", &include_not_tagged_products.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::TagResourceCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -13253,26 +21726,41 @@ pub mod product { } } } -pub mod product_api { +pub mod product { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_product( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - product_id: impl Into, subscription_id: impl Into, - ) -> list_by_product::Builder { - list_by_product::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - product_id: product_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, + expand_groups: None, + tags: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_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(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), } } pub fn create_or_update( @@ -13280,7 +21768,7 @@ pub mod product_api { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - api_id: impl Into, + parameters: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -13288,7 +21776,27 @@ pub mod product_api { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - api_id: api_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } @@ -13297,7 +21805,7 @@ pub mod product_api { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - api_id: impl Into, + if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { delete::Builder { @@ -13305,138 +21813,46 @@ pub mod product_api { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - api_id: api_id.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), + delete_subscriptions: None, } } - pub fn check_entity_exists( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - api_id: impl Into, subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - api_id: api_id.into(), subscription_id: subscription_id.into(), } } - } - pub mod list_by_product { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: 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/{}/products/{}/apis", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_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", "2019-01-01"); - 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::ApiCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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 list_by_tags( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_tags::Builder { + list_by_tags::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, + include_not_tagged_products: None, } } } - pub mod create_or_update { + pub mod list_by_service { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ApiContract), - Ok200(models::ApiContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13464,25 +21880,46 @@ pub mod product_api { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) api_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) expand_groups: Option, + pub(crate) tags: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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 expand_groups(mut self, expand_groups: bool) -> Self { + self.expand_groups = Some(expand_groups); + self + } + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.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/{}/products/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.api_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13490,23 +21927,32 @@ pub mod product_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); + 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()); + } + if let Some(expand_groups) = &self.expand_groups { + url.query_pairs_mut().append_pair("expandGroups", &expand_groups.to_string()); + } + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ApiContract = - 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::ApiContract = + let rsp_value: models::ProductCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -13522,13 +21968,8 @@ pub mod product_api { } } } - pub mod delete { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13557,24 +21998,22 @@ pub mod product_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) api_id: String, 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.ApiManagement/service/{}/products/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.api_id + &self.product_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13588,175 +22027,33 @@ pub mod product_api { let rsp = 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 => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ErrorResponse = + let rsp_value: models::ProductContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) + Ok(rsp_value) } - } - }) - } - } - } - pub mod check_entity_exists { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: String, - pub(crate) api_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/{}/products/{}/apis/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.api_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", "2019-01-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let 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::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 product_group { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - subscription_id: impl Into, - ) -> list_by_product::Builder { - list_by_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - group_id: 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(), - product_id: product_id.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - group_id: 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(), - product_id: product_id.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn check_entity_exists( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - group_id: impl Into, - subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) } } } - pub mod list_by_product { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ProductContract), + Ok200(models::ProductContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13785,28 +22082,19 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, + pub(crate) parameters: models::ProductContract, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, + pub(crate) if_match: 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); + 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> { + 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/{}/products/{}/groups", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -13815,7 +22103,7 @@ pub mod product_group { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13823,26 +22111,27 @@ pub mod product_group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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()); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ProductContract = + 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::GroupCollection = + let rsp_value: models::ProductContract = 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)?; @@ -13858,13 +22147,8 @@ pub mod product_group { } } } - pub mod create_or_update { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::GroupContract), - Ok200(models::GroupContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13893,24 +22177,24 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) group_id: String, + pub(crate) parameters: models::ProductUpdateParameters, + pub(crate) if_match: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.group_id + &self.product_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13918,24 +22202,15 @@ pub mod product_group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::GroupContract = - 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::GroupContract = - 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(()), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -13985,20 +22260,24 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) group_id: String, + pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) delete_subscriptions: Option, } impl Builder { + pub fn delete_subscriptions(mut self, delete_subscriptions: bool) -> Self { + self.delete_subscriptions = Some(delete_subscriptions); + 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/{}/products/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.group_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -14010,6 +22289,11 @@ pub mod product_group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); + req_builder = req_builder.header("If-Match", &self.if_match); + if let Some(delete_subscriptions) = &self.delete_subscriptions { + url.query_pairs_mut() + .append_pair("deleteSubscriptions", &delete_subscriptions.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)?; @@ -14032,7 +22316,7 @@ pub mod product_group { } } } - pub mod check_entity_exists { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14062,20 +22346,18 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) group_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/{}/products/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.group_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -14093,7 +22375,7 @@ pub mod product_group { let 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(()), + 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 = @@ -14108,31 +22390,7 @@ pub mod product_group { } } } -} -pub mod product_subscriptions { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - } - pub mod list { + pub mod list_by_tags { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14161,11 +22419,11 @@ pub mod product_subscriptions { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, + pub(crate) include_not_tagged_products: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -14180,15 +22438,18 @@ pub mod product_subscriptions { self.skip = Some(skip); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn include_not_tagged_products(mut self, include_not_tagged_products: bool) -> Self { + self.include_not_tagged_products = Some(include_not_tagged_products); + 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/{}/products/{}/subscriptions", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/productsByTags", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &self.service_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -14209,6 +22470,10 @@ pub mod product_subscriptions { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } + if let Some(include_not_tagged_products) = &self.include_not_tagged_products { + url.query_pairs_mut() + .append_pair("includeNotTaggedProducts", &include_not_tagged_products.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)?; @@ -14217,7 +22482,7 @@ pub mod product_subscriptions { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::SubscriptionCollection = + let rsp_value: models::TagResourceCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -14236,7 +22501,7 @@ pub mod product_subscriptions { } } } -pub mod product_policy { +pub mod product_api { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -14253,24 +22518,9 @@ pub mod product_policy { service_name: service_name.into(), product_id: product_id.into(), subscription_id: subscription_id.into(), - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - policy_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(), - product_id: product_id.into(), - policy_id: policy_id.into(), - subscription_id: subscription_id.into(), - format: None, + filter: None, + top: None, + skip: None, } } pub fn create_or_update( @@ -14278,8 +22528,7 @@ pub mod product_policy { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - policy_id: impl Into, - parameters: impl Into, + api_id: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -14287,10 +22536,8 @@ pub mod product_policy { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - policy_id: policy_id.into(), - parameters: parameters.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), - if_match: None, } } pub fn delete( @@ -14298,118 +22545,37 @@ pub mod product_policy { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - policy_id: impl Into, - if_match: impl Into, + api_id: 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(), - product_id: product_id.into(), - policy_id: policy_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, - product_id: impl Into, - policy_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(), - product_id: product_id.into(), - policy_id: policy_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_product { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: String, - pub(crate) subscription_id: String, + product_id: product_id.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } } - impl Builder { - 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/{}/products/{}/policies", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_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", "2019-01-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match 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)?; - 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 check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), } } } - pub mod get { + pub mod list_by_product { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14439,25 +22605,33 @@ pub mod product_policy { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) policy_id: String, pub(crate) subscription_id: String, - pub(crate) format: Option, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn format(mut self, format: impl Into) -> Self { - self.format = Some(format.into()); + 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> { + 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/{}/products/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.policy_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -14469,8 +22643,14 @@ pub mod product_policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - if let Some(format) = &self.format { - url.query_pairs_mut().append_pair("format", format); + 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()); @@ -14480,7 +22660,7 @@ pub mod product_policy { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PolicyContract = + let rsp_value: models::ApiCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -14502,8 +22682,8 @@ pub mod product_policy { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::PolicyContract), - Ok200(models::PolicyContract), + Created201(models::ApiContract), + Ok200(models::ApiContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14533,26 +22713,20 @@ pub mod product_policy { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) policy_id: String, - pub(crate) parameters: models::PolicyContract, + pub(crate) api_id: String, 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/{}/products/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.policy_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -14564,11 +22738,7 @@ pub mod product_policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - if let Some(if_match) = &self.if_match { - req_builder = req_builder.header("If-Match", if_match); - } - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -14576,13 +22746,13 @@ pub mod product_policy { 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::PolicyContract = + let rsp_value: models::ApiContract = 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::PolicyContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -14635,21 +22805,20 @@ pub mod product_policy { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) policy_id: String, - pub(crate) if_match: String, + pub(crate) api_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/{}/products/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.policy_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -14661,7 +22830,6 @@ pub mod product_policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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)?; @@ -14684,7 +22852,7 @@ pub mod product_policy { } } } - pub mod get_entity_tag { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14713,210 +22881,90 @@ pub mod product_policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) policy_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/{}/products/{}/policies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.policy_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", "2019-01-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = 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 tag { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - subscription_id: impl Into, - ) -> list_by_product::Builder { - list_by_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - pub fn get_by_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - tag_id: impl Into, - subscription_id: impl Into, - ) -> get_by_product::Builder { - get_by_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn assign_to_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - tag_id: impl Into, - subscription_id: impl Into, - ) -> assign_to_product::Builder { - assign_to_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn detach_from_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - tag_id: impl Into, - subscription_id: impl Into, - ) -> detach_from_product::Builder { - detach_from_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), + pub(crate) product_id: String, + pub(crate) api_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/{}/products/{}/apis/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.api_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", "2019-01-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::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 get_entity_state_by_product( + } +} +pub mod product_group { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_product( &self, resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - tag_id: impl Into, subscription_id: impl Into, - ) -> get_entity_state_by_product::Builder { - get_entity_state_by_product::Builder { + ) -> list_by_product::Builder { + list_by_product::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), - } - } - 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, - scope: None, - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - tag_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(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - tag_id: impl Into, - parameters: impl Into, + product_id: impl Into, + group_id: 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(), - tag_id: tag_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - tag_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - tag_id: tag_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), + product_id: product_id.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -14924,31 +22972,33 @@ pub mod tag { &self, resource_group_name: impl Into, service_name: impl Into, - tag_id: impl Into, - if_match: impl Into, + product_id: impl Into, + group_id: 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(), - tag_id: tag_id.into(), - if_match: if_match.into(), + product_id: product_id.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } - pub fn get_entity_state( + pub fn check_entity_exists( &self, resource_group_name: impl Into, service_name: impl Into, - tag_id: impl Into, + product_id: impl Into, + group_id: impl Into, subscription_id: impl Into, - ) -> get_entity_state::Builder { - get_entity_state::Builder { + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - tag_id: tag_id.into(), + product_id: product_id.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -15001,10 +23051,10 @@ pub mod tag { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/products/{}/tags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -15038,88 +23088,7 @@ pub mod tag { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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_product { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: String, - pub(crate) tag_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/{}/products/{}/tags/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.tag_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", "2019-01-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagContract = + let rsp_value: models::GroupCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -15137,12 +23106,12 @@ pub mod tag { } } } - pub mod assign_to_product { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::TagContract), - Ok200(models::TagContract), + Created201(models::GroupContract), + Ok200(models::GroupContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -15172,20 +23141,20 @@ pub mod tag { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) tag_id: String, + pub(crate) group_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/{}/products/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.tag_id + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -15205,13 +23174,13 @@ pub mod tag { 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::TagContract = + let rsp_value: models::GroupContract = 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::TagContract = + let rsp_value: models::GroupContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -15229,7 +23198,7 @@ pub mod tag { } } } - pub mod detach_from_product { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { @@ -15264,20 +23233,20 @@ pub mod tag { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) tag_id: String, + pub(crate) group_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/{}/products/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.tag_id + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -15311,7 +23280,7 @@ pub mod tag { } } } - pub mod get_entity_state_by_product { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -15341,20 +23310,20 @@ pub mod tag { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) tag_id: String, + pub(crate) group_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/{}/products/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.tag_id + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -15372,7 +23341,7 @@ pub mod tag { let rsp = 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(()), + 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::ErrorResponse = @@ -15387,7 +23356,31 @@ pub mod tag { } } } - pub mod list_by_service { +} +pub mod product_subscriptions { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -15416,11 +23409,11 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) product_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, - pub(crate) scope: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -15435,18 +23428,15 @@ pub mod tag { self.skip = Some(skip); self } - pub fn scope(mut self, scope: impl Into) -> Self { - self.scope = Some(scope.into()); - self - } - 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.ApiManagement/service/{}/tags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/subscriptions", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -15467,9 +23457,6 @@ pub mod tag { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } - if let Some(scope) = &self.scope { - url.query_pairs_mut().append_pair("scope", scope); - } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -15478,7 +23465,7 @@ pub mod tag { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagCollection = + let rsp_value: models::SubscriptionCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -15496,7 +23483,102 @@ pub mod tag { } } } - pub mod get { +} +pub mod product_policy { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list_by_product::Builder { + list_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + format: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_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, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_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, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_product { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -15525,19 +23607,19 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, + pub(crate) product_id: String, 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.ApiManagement/service/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -15557,7 +23639,7 @@ pub mod tag { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagContract = + let rsp_value: models::PolicyCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -15575,13 +23657,8 @@ pub mod tag { } } } - pub mod create_or_update { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::TagContract), - Ok200(models::TagContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15609,29 +23686,30 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, - pub(crate) parameters: models::TagCreateUpdateParameters, + pub(crate) product_id: String, + pub(crate) policy_id: String, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) format: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.into()); self } - 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.ApiManagement/service/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15639,27 +23717,20 @@ pub mod tag { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); - 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); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::TagContract = - 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::TagContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -15675,8 +23746,13 @@ pub mod tag { } } } - pub mod update { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15704,25 +23780,31 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, - pub(crate) parameters: models::TagCreateUpdateParameters, - pub(crate) if_match: String, + pub(crate) product_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15730,15 +23812,28 @@ pub mod tag { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-01-01"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } 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.header("If-Match", &self.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::NO_CONTENT => Ok(()), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + 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::PolicyContract = + 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 = @@ -15787,7 +23882,8 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, + pub(crate) product_id: String, + pub(crate) policy_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -15795,12 +23891,13 @@ pub mod tag { 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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -15835,7 +23932,7 @@ pub mod tag { } } } - pub mod get_entity_state { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -15864,19 +23961,21 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, + pub(crate) product_id: String, + pub(crate) policy_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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); diff --git a/services/mgmt/apimanagement/src/package_2019_12/operations.rs b/services/mgmt/apimanagement/src/package_2019_12/operations.rs index f747c5b96c..7479a2f302 100644 --- a/services/mgmt/apimanagement/src/package_2019_12/operations.rs +++ b/services/mgmt/apimanagement/src/package_2019_12/operations.rs @@ -77,9 +77,21 @@ impl Client { pub fn api(&self) -> api::Client { api::Client(self.clone()) } + pub fn api_diagnostic(&self) -> api_diagnostic::Client { + api_diagnostic::Client(self.clone()) + } pub fn api_export(&self) -> api_export::Client { api_export::Client(self.clone()) } + pub fn api_issue(&self) -> api_issue::Client { + api_issue::Client(self.clone()) + } + pub fn api_issue_attachment(&self) -> api_issue_attachment::Client { + api_issue_attachment::Client(self.clone()) + } + pub fn api_issue_comment(&self) -> api_issue_comment::Client { + api_issue_comment::Client(self.clone()) + } pub fn api_management_operations(&self) -> api_management_operations::Client { api_management_operations::Client(self.clone()) } @@ -89,6 +101,30 @@ impl Client { pub fn api_management_service_skus(&self) -> api_management_service_skus::Client { api_management_service_skus::Client(self.clone()) } + pub fn api_operation(&self) -> api_operation::Client { + api_operation::Client(self.clone()) + } + pub fn api_operation_policy(&self) -> api_operation_policy::Client { + api_operation_policy::Client(self.clone()) + } + pub fn api_policy(&self) -> api_policy::Client { + api_policy::Client(self.clone()) + } + pub fn api_product(&self) -> api_product::Client { + api_product::Client(self.clone()) + } + pub fn api_release(&self) -> api_release::Client { + api_release::Client(self.clone()) + } + pub fn api_revision(&self) -> api_revision::Client { + api_revision::Client(self.clone()) + } + pub fn api_schema(&self) -> api_schema::Client { + api_schema::Client(self.clone()) + } + pub fn api_tag_description(&self) -> api_tag_description::Client { + api_tag_description::Client(self.clone()) + } pub fn api_version_set(&self) -> api_version_set::Client { api_version_set::Client(self.clone()) } @@ -164,6 +200,9 @@ impl Client { pub fn open_id_connect_provider(&self) -> open_id_connect_provider::Client { open_id_connect_provider::Client(self.clone()) } + pub fn operation(&self) -> operation::Client { + operation::Client(self.clone()) + } pub fn policy(&self) -> policy::Client { policy::Client(self.clone()) } @@ -244,6 +283,152 @@ pub enum Error { #[error(transparent)] ApiExport_Get(#[from] api_export::get::Error), #[error(transparent)] + Api_ListByService(#[from] api::list_by_service::Error), + #[error(transparent)] + Api_Get(#[from] api::get::Error), + #[error(transparent)] + Api_CreateOrUpdate(#[from] api::create_or_update::Error), + #[error(transparent)] + Api_Update(#[from] api::update::Error), + #[error(transparent)] + Api_Delete(#[from] api::delete::Error), + #[error(transparent)] + Api_GetEntityTag(#[from] api::get_entity_tag::Error), + #[error(transparent)] + ApiRevision_ListByService(#[from] api_revision::list_by_service::Error), + #[error(transparent)] + ApiRelease_ListByService(#[from] api_release::list_by_service::Error), + #[error(transparent)] + ApiRelease_Get(#[from] api_release::get::Error), + #[error(transparent)] + ApiRelease_CreateOrUpdate(#[from] api_release::create_or_update::Error), + #[error(transparent)] + ApiRelease_Update(#[from] api_release::update::Error), + #[error(transparent)] + ApiRelease_Delete(#[from] api_release::delete::Error), + #[error(transparent)] + ApiRelease_GetEntityTag(#[from] api_release::get_entity_tag::Error), + #[error(transparent)] + ApiOperation_ListByApi(#[from] api_operation::list_by_api::Error), + #[error(transparent)] + ApiOperation_Get(#[from] api_operation::get::Error), + #[error(transparent)] + ApiOperation_CreateOrUpdate(#[from] api_operation::create_or_update::Error), + #[error(transparent)] + ApiOperation_Update(#[from] api_operation::update::Error), + #[error(transparent)] + ApiOperation_Delete(#[from] api_operation::delete::Error), + #[error(transparent)] + ApiOperation_GetEntityTag(#[from] api_operation::get_entity_tag::Error), + #[error(transparent)] + ApiOperationPolicy_ListByOperation(#[from] api_operation_policy::list_by_operation::Error), + #[error(transparent)] + ApiOperationPolicy_Get(#[from] api_operation_policy::get::Error), + #[error(transparent)] + ApiOperationPolicy_CreateOrUpdate(#[from] api_operation_policy::create_or_update::Error), + #[error(transparent)] + ApiOperationPolicy_Delete(#[from] api_operation_policy::delete::Error), + #[error(transparent)] + ApiOperationPolicy_GetEntityTag(#[from] api_operation_policy::get_entity_tag::Error), + #[error(transparent)] + Tag_ListByOperation(#[from] tag::list_by_operation::Error), + #[error(transparent)] + Tag_GetByOperation(#[from] tag::get_by_operation::Error), + #[error(transparent)] + Tag_AssignToOperation(#[from] tag::assign_to_operation::Error), + #[error(transparent)] + Tag_DetachFromOperation(#[from] tag::detach_from_operation::Error), + #[error(transparent)] + Tag_GetEntityStateByOperation(#[from] tag::get_entity_state_by_operation::Error), + #[error(transparent)] + ApiProduct_ListByApis(#[from] api_product::list_by_apis::Error), + #[error(transparent)] + ApiPolicy_ListByApi(#[from] api_policy::list_by_api::Error), + #[error(transparent)] + ApiPolicy_Get(#[from] api_policy::get::Error), + #[error(transparent)] + ApiPolicy_CreateOrUpdate(#[from] api_policy::create_or_update::Error), + #[error(transparent)] + ApiPolicy_Delete(#[from] api_policy::delete::Error), + #[error(transparent)] + ApiPolicy_GetEntityTag(#[from] api_policy::get_entity_tag::Error), + #[error(transparent)] + ApiSchema_ListByApi(#[from] api_schema::list_by_api::Error), + #[error(transparent)] + ApiSchema_Get(#[from] api_schema::get::Error), + #[error(transparent)] + ApiSchema_CreateOrUpdate(#[from] api_schema::create_or_update::Error), + #[error(transparent)] + ApiSchema_Delete(#[from] api_schema::delete::Error), + #[error(transparent)] + ApiSchema_GetEntityTag(#[from] api_schema::get_entity_tag::Error), + #[error(transparent)] + ApiDiagnostic_ListByService(#[from] api_diagnostic::list_by_service::Error), + #[error(transparent)] + ApiDiagnostic_Get(#[from] api_diagnostic::get::Error), + #[error(transparent)] + ApiDiagnostic_CreateOrUpdate(#[from] api_diagnostic::create_or_update::Error), + #[error(transparent)] + ApiDiagnostic_Update(#[from] api_diagnostic::update::Error), + #[error(transparent)] + ApiDiagnostic_Delete(#[from] api_diagnostic::delete::Error), + #[error(transparent)] + ApiDiagnostic_GetEntityTag(#[from] api_diagnostic::get_entity_tag::Error), + #[error(transparent)] + ApiIssue_ListByService(#[from] api_issue::list_by_service::Error), + #[error(transparent)] + ApiIssue_Get(#[from] api_issue::get::Error), + #[error(transparent)] + ApiIssue_CreateOrUpdate(#[from] api_issue::create_or_update::Error), + #[error(transparent)] + ApiIssue_Update(#[from] api_issue::update::Error), + #[error(transparent)] + ApiIssue_Delete(#[from] api_issue::delete::Error), + #[error(transparent)] + ApiIssue_GetEntityTag(#[from] api_issue::get_entity_tag::Error), + #[error(transparent)] + ApiIssueComment_ListByService(#[from] api_issue_comment::list_by_service::Error), + #[error(transparent)] + ApiIssueComment_Get(#[from] api_issue_comment::get::Error), + #[error(transparent)] + ApiIssueComment_CreateOrUpdate(#[from] api_issue_comment::create_or_update::Error), + #[error(transparent)] + ApiIssueComment_Delete(#[from] api_issue_comment::delete::Error), + #[error(transparent)] + ApiIssueComment_GetEntityTag(#[from] api_issue_comment::get_entity_tag::Error), + #[error(transparent)] + ApiIssueAttachment_ListByService(#[from] api_issue_attachment::list_by_service::Error), + #[error(transparent)] + ApiIssueAttachment_Get(#[from] api_issue_attachment::get::Error), + #[error(transparent)] + ApiIssueAttachment_CreateOrUpdate(#[from] api_issue_attachment::create_or_update::Error), + #[error(transparent)] + ApiIssueAttachment_Delete(#[from] api_issue_attachment::delete::Error), + #[error(transparent)] + ApiIssueAttachment_GetEntityTag(#[from] api_issue_attachment::get_entity_tag::Error), + #[error(transparent)] + ApiTagDescription_ListByService(#[from] api_tag_description::list_by_service::Error), + #[error(transparent)] + ApiTagDescription_Get(#[from] api_tag_description::get::Error), + #[error(transparent)] + ApiTagDescription_CreateOrUpdate(#[from] api_tag_description::create_or_update::Error), + #[error(transparent)] + ApiTagDescription_Delete(#[from] api_tag_description::delete::Error), + #[error(transparent)] + ApiTagDescription_GetEntityTag(#[from] api_tag_description::get_entity_tag::Error), + #[error(transparent)] + Tag_ListByApi(#[from] tag::list_by_api::Error), + #[error(transparent)] + Tag_GetByApi(#[from] tag::get_by_api::Error), + #[error(transparent)] + Tag_AssignToApi(#[from] tag::assign_to_api::Error), + #[error(transparent)] + Tag_DetachFromApi(#[from] tag::detach_from_api::Error), + #[error(transparent)] + Tag_GetEntityStateByApi(#[from] tag::get_entity_state_by_api::Error), + #[error(transparent)] + Operation_ListByTags(#[from] operation::list_by_tags::Error), + #[error(transparent)] Api_ListByTags(#[from] api::list_by_tags::Error), #[error(transparent)] ApiVersionSet_ListByService(#[from] api_version_set::list_by_service::Error), @@ -832,6 +1017,109 @@ pub mod api { use super::models; 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, + tags: None, + expand_api_version_set: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + delete_revisions: None, + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } pub fn list_by_tags( &self, resource_group_name: impl Into, @@ -850,7 +1138,7 @@ pub mod api { } } } - pub mod list_by_tags { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -883,7 +1171,8 @@ pub mod api { pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, - pub(crate) include_not_tagged_apis: Option, + pub(crate) tags: Option, + pub(crate) expand_api_version_set: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -898,14 +1187,18 @@ pub mod api { self.skip = Some(skip); self } - pub fn include_not_tagged_apis(mut self, include_not_tagged_apis: bool) -> Self { - self.include_not_tagged_apis = Some(include_not_tagged_apis); + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.into()); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn expand_api_version_set(mut self, expand_api_version_set: bool) -> Self { + self.expand_api_version_set = Some(expand_api_version_set); + 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/{}/apisByTags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -930,9 +1223,12 @@ pub mod api { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } - if let Some(include_not_tagged_apis) = &self.include_not_tagged_apis { + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } + if let Some(expand_api_version_set) = &self.expand_api_version_set { url.query_pairs_mut() - .append_pair("includeNotTaggedApis", &include_not_tagged_apis.to_string()); + .append_pair("expandApiVersionSet", &expand_api_version_set.to_string()); } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); @@ -942,7 +1238,7 @@ pub mod api { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagResourceCollection = + let rsp_value: models::ApiCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -960,255 +1256,48 @@ pub mod api { } } } -} -pub mod api_version_set { - use super::models; - 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, - version_set_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(), - version_set_id: version_set_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - version_set_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(), - version_set_id: version_set_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - version_set_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - version_set_id: version_set_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - version_set_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(), - version_set_id: version_set_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, - version_set_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(), - version_set_id: version_set_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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/{}/apiVersionSets", - 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", "2019-12-01"); - 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::ApiVersionSetCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_id: String, + pub(crate) api_id: String, 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.ApiManagement/service/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1228,7 +1317,7 @@ pub mod api_version_set { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiVersionSetContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1250,8 +1339,9 @@ pub mod api_version_set { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::ApiVersionSetContract), - Ok200(models::ApiVersionSetContract), + Created201(models::ApiContract), + Accepted202, + Ok200(models::ApiContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1280,8 +1370,8 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, - pub(crate) parameters: models::ApiVersionSetContract, + pub(crate) api_id: String, + pub(crate) parameters: models::ApiCreateOrUpdateParameter, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -1293,12 +1383,12 @@ pub mod api_version_set { 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/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1322,13 +1412,14 @@ pub mod api_version_set { 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::ApiVersionSetContract = + let rsp_value: models::ApiContract = 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), http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiVersionSetContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -1375,8 +1466,8 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, - pub(crate) parameters: models::ApiVersionSetUpdateParameters, + pub(crate) api_id: String, + pub(crate) parameters: models::ApiUpdateContract, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -1384,12 +1475,12 @@ pub mod api_version_set { 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/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1458,20 +1549,25 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, + pub(crate) api_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) delete_revisions: Option, } impl Builder { + pub fn delete_revisions(mut self, delete_revisions: bool) -> Self { + self.delete_revisions = Some(delete_revisions); + 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/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1483,6 +1579,9 @@ pub mod api_version_set { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); + if let Some(delete_revisions) = &self.delete_revisions { + url.query_pairs_mut().append_pair("deleteRevisions", &delete_revisions.to_string()); + } 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()); @@ -1535,19 +1634,19 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, + pub(crate) api_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/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1580,128 +1679,7 @@ pub mod api_version_set { } } } -} -pub mod authorization_server { - use super::models; - 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, - authsid: 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(), - authsid: authsid.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: 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(), - authsid: authsid.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - authsid: authsid.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: 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(), - authsid: authsid.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, - authsid: 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(), - authsid: authsid.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_secrets( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: impl Into, - subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - authsid: authsid.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod list_by_tags { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1734,6 +1712,7 @@ pub mod authorization_server { pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, + pub(crate) include_not_tagged_apis: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -1748,12 +1727,14 @@ pub mod authorization_server { self.skip = Some(skip); self } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn include_not_tagged_apis(mut self, include_not_tagged_apis: bool) -> Self { + self.include_not_tagged_apis = Some(include_not_tagged_apis); + 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/{}/authorizationServers", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apisByTags", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -1778,6 +1759,10 @@ pub mod authorization_server { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } + if let Some(include_not_tagged_apis) = &self.include_not_tagged_apis { + url.query_pairs_mut() + .append_pair("includeNotTaggedApis", &include_not_tagged_apis.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)?; @@ -1786,7 +1771,7 @@ pub mod authorization_server { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerCollection = + let rsp_value: models::TagResourceCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1804,7 +1789,31 @@ pub mod authorization_server { } } } - pub mod get { +} +pub mod api_revision { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1833,21 +1842,34 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, + pub(crate) api_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/revisions", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1859,6 +1881,15 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); + 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)?; @@ -1867,7 +1898,7 @@ pub mod authorization_server { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerContract = + let rsp_value: models::ApiRevisionCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1885,63 +1916,185 @@ pub mod authorization_server { } } } - pub mod create_or_update { - use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::AuthorizationServerContract), - Ok200(models::AuthorizationServerContract), +} +pub mod api_release { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } } - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_id.into(), + subscription_id: subscription_id.into(), + } } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) authsid: String, - pub(crate) parameters: models::AuthorizationServerContract, + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + release_id: release_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_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, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + 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> { + 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -1949,27 +2102,26 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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); + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerContract = - 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::AuthorizationServerContract = + let rsp_value: models::ApiReleaseCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -1985,7 +2137,7 @@ pub mod authorization_server { } } } - pub mod update { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2014,25 +2166,25 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, - pub(crate) parameters: models::AuthorizationServerUpdateContract, - pub(crate) if_match: String, + pub(crate) api_id: String, + pub(crate) release_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2040,15 +2192,18 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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.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::NO_CONTENT => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiReleaseContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -2063,12 +2218,12 @@ pub mod authorization_server { } } } - pub mod delete { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200, - NoContent204, + Created201(models::ApiReleaseContract), + Ok200(models::ApiReleaseContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2097,24 +2252,31 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, - pub(crate) if_match: String, + pub(crate) api_id: String, + pub(crate) release_id: String, + pub(crate) parameters: models::ApiReleaseContract, 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2122,15 +2284,28 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - req_builder = req_builder.header("If-Match", &self.if_match); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiReleaseContract = + 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::ApiReleaseContract = + 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 = @@ -2145,7 +2320,7 @@ pub mod authorization_server { } } } - pub mod get_entity_tag { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2174,23 +2349,27 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, + pub(crate) api_id: String, + pub(crate) release_id: String, + pub(crate) parameters: models::ApiReleaseContract, + pub(crate) if_match: 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2198,13 +2377,15 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => Ok(()), + 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::ErrorResponse = @@ -2219,8 +2400,13 @@ pub mod authorization_server { } } } - pub mod list_secrets { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -2248,16 +2434,26 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, + pub(crate) api_id: String, + pub(crate) release_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> { + 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/{}/authorizationServers/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . authsid) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2265,19 +2461,15 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); + req_builder = req_builder.header("If-Match", &self.if_match); 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::ClientSecretContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -2292,39 +2484,120 @@ pub mod authorization_server { } } } -} -pub mod backend { - use super::models; - 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 { + pub mod get_entity_tag { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) release_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/{}/apis/{}/releases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.release_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_operation { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, + tags: None, } } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, + api_id: impl Into, + operation_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(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), } } @@ -2332,15 +2605,17 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_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(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -2350,8 +2625,9 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -2359,7 +2635,8 @@ pub mod backend { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), @@ -2369,7 +2646,8 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, + api_id: impl Into, + operation_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -2377,7 +2655,8 @@ pub mod backend { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -2386,35 +2665,21 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, + api_id: impl Into, + operation_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(), - backend_id: backend_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn reconnect( - &self, - resource_group_name: impl Into, - service_name: impl Into, - backend_id: impl Into, - subscription_id: impl Into, - ) -> reconnect::Builder { - reconnect::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), - parameters: None, } } } - pub mod list_by_service { + pub mod list_by_api { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2443,10 +2708,12 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) api_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, + pub(crate) tags: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -2461,14 +2728,19 @@ pub mod backend { self.skip = Some(skip); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.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/{}/backends", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2489,6 +2761,9 @@ pub mod backend { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -2497,7 +2772,7 @@ pub mod backend { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackendCollection = + let rsp_value: models::OperationCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2544,19 +2819,21 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, 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.ApiManagement/service/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2576,7 +2853,7 @@ pub mod backend { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackendContract = + let rsp_value: models::OperationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2598,8 +2875,8 @@ pub mod backend { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::BackendContract), - Ok200(models::BackendContract), + Created201(models::OperationContract), + Ok200(models::OperationContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2628,8 +2905,9 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, - pub(crate) parameters: models::BackendContract, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) parameters: models::OperationContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -2641,12 +2919,13 @@ pub mod backend { 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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2670,13 +2949,13 @@ pub mod backend { 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::BackendContract = + let rsp_value: models::OperationContract = 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::BackendContract = + let rsp_value: models::OperationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -2723,8 +3002,9 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, - pub(crate) parameters: models::BackendUpdateParameters, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) parameters: models::OperationUpdateContract, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -2732,12 +3012,13 @@ pub mod backend { 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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2806,7 +3087,8 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -2814,12 +3096,13 @@ pub mod backend { 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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2883,19 +3166,21 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, + pub(crate) api_id: String, + pub(crate) operation_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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2928,167 +3213,77 @@ pub mod backend { } } } - pub mod reconnect { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) backend_id: 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<(), Error>> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}/reconnect", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.backend_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", "2019-12-01"); - 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::ACCEPTED => 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 cache { +pub mod api_operation_policy { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_service( + pub fn list_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> list_by_operation::Builder { + list_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), - top: None, - skip: None, } } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_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(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), + format: None, } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_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(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, } } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - cache_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - cache_id: cache_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -3096,7 +3291,9 @@ pub mod cache { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -3105,19 +3302,23 @@ pub mod cache { &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_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(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_service { + pub mod list_by_operation { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3146,27 +3347,21 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, pub(crate) subscription_id: String, - pub(crate) top: Option, - pub(crate) skip: Option, } impl Builder { - 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> { + 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/{}/caches", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -3178,12 +3373,6 @@ pub mod cache { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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)?; @@ -3192,7 +3381,7 @@ pub mod cache { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CacheCollection = + let rsp_value: models::PolicyCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -3239,20 +3428,20 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_id: String, pub(crate) subscription_id: String, + pub(crate) format: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3263,6 +3452,9 @@ pub mod cache { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -3271,7 +3463,7 @@ pub mod cache { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CacheContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -3293,8 +3485,8 @@ pub mod cache { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::CacheContract), - Ok200(models::CacheContract), + Created201(models::PolicyContract), + Ok200(models::PolicyContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3323,8 +3515,10 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, - pub(crate) parameters: models::CacheContract, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -3335,14 +3529,7 @@ pub mod cache { } 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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3365,13 +3552,13 @@ pub mod cache { 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::CacheContract = + let rsp_value: models::PolicyContract = 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::CacheContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -3389,84 +3576,6 @@ pub mod cache { } } } - pub mod update { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) cache_id: String, - pub(crate) parameters: models::CacheUpdateParameters, - pub(crate) if_match: 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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_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", "2019-12-01"); - 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.header("If-Match", &self.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::NO_CONTENT => 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 delete { use super::models; #[derive(Debug)] @@ -3501,21 +3610,16 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3578,20 +3682,15 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3624,64 +3723,7191 @@ pub mod cache { } } } -pub mod certificate { +pub mod tag { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_service( + pub fn list_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> list_by_operation::Builder { + list_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, } } - pub fn get( + pub fn get_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> get::Builder { - get::Builder { + ) -> get_by_operation::Builder { + get_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), } } - pub fn create_or_update( + pub fn assign_to_operation( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> create_or_update::Builder { - create_or_update::Builder { + ) -> assign_to_operation::Builder { + assign_to_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), - parameters: parameters.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), - if_match: None, } } - pub fn delete( + pub fn detach_from_operation( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> detach_from_operation::Builder { + detach_from_operation::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state_by_operation( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state_by_operation::Builder { + get_entity_state_by_operation::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_by_api::Builder { + get_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn assign_to_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> assign_to_api::Builder { + assign_to_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn detach_from_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> detach_from_api::Builder { + detach_from_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state_by_api::Builder { + get_entity_state_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list_by_product::Builder { + list_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_by_product::Builder { + get_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn assign_to_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> assign_to_product::Builder { + assign_to_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn detach_from_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> detach_from_product::Builder { + detach_from_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state_by_product::Builder { + get_entity_state_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + 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, + scope: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_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(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_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(), + tag_id: tag_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + tag_id: tag_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_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(), + tag_id: tag_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state::Builder { + get_entity_state::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: 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/{}/apis/{}/operations/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2019-12-01"); + 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::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 assign_to_operation { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TagContract = + 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::TagContract = + 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 detach_from_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_state_by_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2019-12-01"); + 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::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 assign_to_api { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TagContract = + 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::TagContract = + 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 detach_from_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_state_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_by_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: 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/{}/products/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_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", "2019-12-01"); + 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::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 assign_to_product { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TagContract = + 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::TagContract = + 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 detach_from_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_state_by_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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, + pub(crate) scope: 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 scope(mut self, scope: impl Into) -> Self { + self.scope = Some(scope.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/{}/tags", + 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", "2019-12-01"); + 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()); + } + if let Some(scope) = &self.scope { + url.query_pairs_mut().append_pair("scope", scope); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_id: String, + pub(crate) parameters: models::TagCreateUpdateParameters, + 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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2019-12-01"); + 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::TagContract = + 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::TagContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_id: String, + pub(crate) parameters: models::TagCreateUpdateParameters, + pub(crate) if_match: 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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2019-12-01"); + 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.header("If-Match", &self.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::NO_CONTENT => 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2019-12-01"); + 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_state { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_product { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_apis( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_apis::Builder { + list_by_apis::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list_by_apis { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/products", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2019-12-01"); + 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::ProductCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 api_policy { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + format: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_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, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_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, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_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/{}/apis/{}/policies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match 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)?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_id: String, + pub(crate) subscription_id: String, + pub(crate) format: Option, + } + impl Builder { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2019-12-01"); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, + 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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2019-12-01"); + 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::PolicyContract = + 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::PolicyContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2019-12-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_schema { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.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, + api_id: 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(), + api_id: api_id.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, + api_id: 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(), + api_id: api_id.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, + api_id: 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(), + api_id: api_id.into(), + schema_id: schema_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + force: None, + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + schema_id: schema_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/schemas", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2019-12-01"); + 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::SchemaCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SchemaContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Accepted202, + Created201(models::SchemaContract), + Ok200(models::SchemaContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) schema_id: String, + pub(crate) parameters: models::SchemaContract, + 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2019-12-01"); + 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::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SchemaContract = + 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::SchemaContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) schema_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + pub(crate) force: Option, + } + impl Builder { + pub fn force(mut self, force: bool) -> Self { + self.force = Some(force); + 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2019-12-01"); + if let Some(force) = &self.force { + url.query_pairs_mut().append_pair("force", &force.to_string()); + } + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_diagnostic { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.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, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_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, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/diagnostics", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2019-12-01"); + 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::DiagnosticCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::DiagnosticContract), + Ok200(models::DiagnosticContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + 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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2019-12-01"); + 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::DiagnosticContract = + 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::DiagnosticContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + pub(crate) if_match: 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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2019-12-01"); + 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.header("If-Match", &self.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::NO_CONTENT => 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2019-12-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_issue { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + expand_comments_attachments: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + expand_comments_attachments: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + issue_id: issue_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_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, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) expand_comments_attachments: 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 expand_comments_attachments(mut self, expand_comments_attachments: bool) -> Self { + self.expand_comments_attachments = Some(expand_comments_attachments); + 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/{}/apis/{}/issues", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2019-12-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(expand_comments_attachments) = &self.expand_comments_attachments { + url.query_pairs_mut() + .append_pair("expandCommentsAttachments", &expand_comments_attachments.to_string()); + } + 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::IssueCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) subscription_id: String, + pub(crate) expand_comments_attachments: Option, + } + impl Builder { + pub fn expand_comments_attachments(mut self, expand_comments_attachments: bool) -> Self { + self.expand_comments_attachments = Some(expand_comments_attachments); + 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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2019-12-01"); + if let Some(expand_comments_attachments) = &self.expand_comments_attachments { + url.query_pairs_mut() + .append_pair("expandCommentsAttachments", &expand_comments_attachments.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::IssueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueContract), + Ok200(models::IssueContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) parameters: models::IssueContract, + 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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2019-12-01"); + 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::IssueContract = + 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::IssueContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) parameters: models::IssueUpdateContract, + pub(crate) if_match: 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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2019-12-01"); + 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.header("If-Match", &self.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::NO_CONTENT => 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2019-12-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_issue_comment { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: 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(), + api_id: api_id.into(), + issue_id: issue_id.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, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_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, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_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, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: 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/{}/apis/{}/issues/{}/comments", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2019-12-01"); + 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::IssueCommentCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueCommentContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueCommentContract), + Ok200(models::IssueCommentContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_id: String, + pub(crate) parameters: models::IssueCommentContract, + 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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2019-12-01"); + 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::IssueCommentContract = + 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::IssueCommentContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2019-12-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_issue_attachment { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: 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(), + api_id: api_id.into(), + issue_id: issue_id.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, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_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, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_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, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: 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/{}/apis/{}/issues/{}/attachments", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2019-12-01"); + 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::IssueAttachmentCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueAttachmentContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueAttachmentContract), + Ok200(models::IssueAttachmentContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_id: String, + pub(crate) parameters: models::IssueAttachmentContract, + 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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2019-12-01"); + 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::IssueAttachmentContract = + 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::IssueAttachmentContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2019-12-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_tag_description { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.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, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_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, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_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, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/tagDescriptions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2019-12-01"); + 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::TagDescriptionCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagDescriptionContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::TagDescriptionContract), + Ok200(models::TagDescriptionContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_id: String, + pub(crate) parameters: models::TagDescriptionCreateParameters, + 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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2019-12-01"); + 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::TagDescriptionContract = + 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::TagDescriptionContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2019-12-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 operation { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_tags( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_tags::Builder { + list_by_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + include_not_tagged_operations: None, + } + } + } + pub mod list_by_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) include_not_tagged_operations: 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 include_not_tagged_operations(mut self, include_not_tagged_operations: bool) -> Self { + self.include_not_tagged_operations = Some(include_not_tagged_operations); + 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/{}/apis/{}/operationsByTags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2019-12-01"); + 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()); + } + if let Some(include_not_tagged_operations) = &self.include_not_tagged_operations { + url.query_pairs_mut() + .append_pair("includeNotTaggedOperations", &include_not_tagged_operations.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::TagResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod api_version_set { + use super::models; + 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, + version_set_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(), + version_set_id: version_set_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_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(), + version_set_id: version_set_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + version_set_id: version_set_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_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(), + version_set_id: version_set_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, + version_set_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(), + version_set_id: version_set_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/apiVersionSets", + 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", "2019-12-01"); + 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::ApiVersionSetCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiVersionSetContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::ApiVersionSetContract), + Ok200(models::ApiVersionSetContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_id: String, + pub(crate) parameters: models::ApiVersionSetContract, + 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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2019-12-01"); + 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::ApiVersionSetContract = + 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::ApiVersionSetContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_id: String, + pub(crate) parameters: models::ApiVersionSetUpdateParameters, + pub(crate) if_match: 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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2019-12-01"); + 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.header("If-Match", &self.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::NO_CONTENT => 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2019-12-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 authorization_server { + use super::models; + 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, + authsid: 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(), + authsid: authsid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: 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(), + authsid: authsid.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + authsid: authsid.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -3689,7 +10915,7 @@ pub mod certificate { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), + authsid: authsid.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -3698,20 +10924,224 @@ pub mod certificate { &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, + authsid: 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(), - certificate_id: certificate_id.into(), + authsid: authsid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + authsid: authsid.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_service { + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/authorizationServers", + 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", "2019-12-01"); + 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::AuthorizationServerCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationServerContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::AuthorizationServerContract), + Ok200(models::AuthorizationServerContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -3739,36 +11169,29 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) authsid: String, + pub(crate) parameters: models::AuthorizationServerContract, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, + pub(crate) if_match: 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); + 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> { + 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/{}/certificates", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/authorizationServers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.authsid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -3776,27 +11199,188 @@ pub mod certificate { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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()); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::AuthorizationServerContract = + 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::CertificateCollection = + let rsp_value: models::AuthorizationServerContract = 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)?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: String, + pub(crate) parameters: models::AuthorizationServerUpdateContract, + pub(crate) if_match: 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2019-12-01"); + 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.header("If-Match", &self.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::NO_CONTENT => 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2019-12-01"); + 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 = @@ -3811,7 +11395,7 @@ pub mod certificate { } } } - pub mod get { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3840,23 +11424,23 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, + pub(crate) authsid: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/authorizationServers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.certificate_id + &self.authsid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -3870,12 +11454,7 @@ pub mod certificate { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CertificateContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -3890,13 +11469,8 @@ pub mod certificate { } } } - pub mod create_or_update { + pub mod list_secrets { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::CertificateContract), - Ok200(models::CertificateContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -3924,29 +11498,16 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, - pub(crate) parameters: models::CertificateCreateOrUpdateParameters, + pub(crate) authsid: String, 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> { + 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/{}/certificates/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.certificate_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/authorizationServers/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . authsid) ; let mut url = 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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -3954,27 +11515,18 @@ pub mod certificate { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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); - } + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CertificateContract = - 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::CertificateContract = + let rsp_value: models::ClientSecretContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -3990,13 +11542,130 @@ pub mod certificate { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, +} +pub mod backend { + use super::models; + 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, + backend_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(), + backend_id: backend_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_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(), + backend_id: backend_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + backend_id: backend_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_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(), + backend_id: backend_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, + backend_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(), + backend_id: backend_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn reconnect( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_id: impl Into, + subscription_id: impl Into, + ) -> reconnect::Builder { + reconnect::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + backend_id: backend_id.into(), + subscription_id: subscription_id.into(), + parameters: None, + } } + } + pub mod list_by_service { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -4024,24 +11693,36 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, - pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/certificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.certificate_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4049,15 +11730,27 @@ pub mod certificate { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - req_builder = req_builder.header("If-Match", &self.if_match); + 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 => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackendCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -4072,7 +11765,7 @@ pub mod certificate { } } } - pub mod get_entity_tag { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4101,23 +11794,23 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, + pub(crate) backend_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/certificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.certificate_id + &self.backend_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4131,7 +11824,12 @@ pub mod certificate { let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackendContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -4146,72 +11844,13 @@ pub mod certificate { } } } -} -pub mod content_type { - use super::models; - 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(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - content_type_id: 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(), - content_type_id: content_type_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - content_type_id: 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(), - content_type_id: content_type_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn get_entity_tag( - &self, - resource_group_name: impl Into, - service_name: impl Into, - content_type_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(), - content_type_id: content_type_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::BackendContract), + Ok200(models::BackendContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -4239,21 +11878,29 @@ pub mod content_type { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) backend_id: String, + pub(crate) parameters: models::BackendContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/contentTypes", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.backend_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4261,17 +11908,27 @@ pub mod content_type { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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::BackendContract = + 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::ContentTypeCollection = + let rsp_value: models::BackendContract = 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)?; @@ -4287,13 +11944,8 @@ pub mod content_type { } } } - pub mod create_or_update { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ContentTypeContract), - Ok200(models::ContentTypeContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -4321,23 +11973,25 @@ pub mod content_type { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, + pub(crate) backend_id: String, + pub(crate) parameters: models::BackendUpdateParameters, + pub(crate) if_match: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.content_type_id + &self.backend_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4345,24 +11999,15 @@ pub mod content_type { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::ContentTypeContract = - 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::ContentTypeContract = - 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(()), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -4379,6 +12024,11 @@ pub mod content_type { } pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -4406,19 +12056,20 @@ pub mod content_type { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, + pub(crate) backend_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<(), Error>> { + 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/{}/contentTypes/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.content_type_id + &self.backend_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -4430,13 +12081,15 @@ pub mod content_type { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); + 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(()), + 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 = @@ -4480,19 +12133,19 @@ pub mod content_type { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, + pub(crate) backend_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/{}/contentTypes/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.content_type_id + &self.backend_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -4525,28 +12178,7 @@ pub mod content_type { } } } -} -pub mod content_types { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - content_type_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(), - content_type_id: content_type_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod get { + pub mod reconnect { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4575,23 +12207,28 @@ pub mod content_types { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, + pub(crate) backend_id: String, pub(crate) subscription_id: String, + pub(crate) parameters: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}/reconnect", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.content_type_id + &self.backend_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4599,18 +12236,18 @@ pub mod content_types { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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::ContentTypeContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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::ErrorResponse = @@ -4626,7 +12263,7 @@ pub mod content_types { } } } -pub mod content_item { +pub mod cache { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -4634,31 +12271,29 @@ pub mod content_item { &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: 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(), - content_type_id: content_type_id.into(), subscription_id: subscription_id.into(), + top: None, + skip: None, } } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: impl Into, - content_item_id: impl Into, + cache_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(), - content_type_id: content_type_id.into(), - content_item_id: content_item_id.into(), + cache_id: cache_id.into(), subscription_id: subscription_id.into(), } } @@ -4666,16 +12301,36 @@ pub mod content_item { &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: impl Into, - content_item_id: impl Into, + cache_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(), - content_type_id: content_type_id.into(), - content_item_id: content_item_id.into(), + cache_id: cache_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + cache_id: cache_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } @@ -4683,16 +12338,16 @@ pub mod content_item { &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: impl Into, - content_item_id: impl Into, + cache_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(), - content_type_id: content_type_id.into(), - content_item_id: content_item_id.into(), + cache_id: cache_id.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } @@ -4700,16 +12355,14 @@ pub mod content_item { &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: impl Into, - content_item_id: impl Into, + cache_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(), - content_type_id: content_type_id.into(), - content_item_id: content_item_id.into(), + cache_id: cache_id.into(), subscription_id: subscription_id.into(), } } @@ -4743,19 +12396,27 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/contentTypes/{}/contentItems", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.content_type_id + &self.service_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -4767,6 +12428,12 @@ pub mod content_item { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); + 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)?; @@ -4775,7 +12442,7 @@ pub mod content_item { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ContentItemCollection = + let rsp_value: models::CacheCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -4822,14 +12489,20 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) content_item_id: String, + pub(crate) cache_id: String, 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.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.cache_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); @@ -4848,7 +12521,7 @@ pub mod content_item { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ContentItemContract = + let rsp_value: models::CacheContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -4870,8 +12543,8 @@ pub mod content_item { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::ContentItemContract), - Ok200(models::ContentItemContract), + Created201(models::CacheContract), + Ok200(models::CacheContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4900,14 +12573,26 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) content_item_id: String, + pub(crate) cache_id: String, + pub(crate) parameters: models::CacheContract, 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/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.cache_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); @@ -4918,7 +12603,11 @@ pub mod content_item { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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)?; @@ -4926,13 +12615,13 @@ pub mod content_item { 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::ContentItemContract = + let rsp_value: models::CacheContract = 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::ContentItemContract = + let rsp_value: models::CacheContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -4950,7 +12639,7 @@ pub mod content_item { } } } - pub mod delete { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4979,17 +12668,25 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) content_item_id: String, + pub(crate) cache_id: String, + pub(crate) parameters: models::CacheUpdateParameters, + pub(crate) if_match: 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/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.cache_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4997,13 +12694,15 @@ pub mod content_item { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => Ok(()), + 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::ErrorResponse = @@ -5018,8 +12717,13 @@ pub mod content_item { } } } - pub mod get_entity_tag { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -5047,17 +12751,24 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) content_item_id: String, + pub(crate) cache_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<(), Error>> { + 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/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.cache_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5065,13 +12776,15 @@ pub mod content_item { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); + 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(()), + 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 = @@ -5086,99 +12799,7 @@ pub mod content_item { } } } -} -pub mod api_management_operations { - use super::models; - 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; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, - #[error("Failed to parse request URL")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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.ApiManagement/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", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match 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 api_management_service_skus { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Gets available SKUs for API Management service"] - pub fn list_available_service_skus( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> list_available_service_skus::Builder { - list_available_service_skus::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_available_service_skus { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5207,21 +12828,23 @@ pub mod api_management_service_skus { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) cache_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/skus", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.cache_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5235,12 +12858,7 @@ pub mod api_management_service_skus { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ResourceSkuResults = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -5256,50 +12874,38 @@ pub mod api_management_service_skus { } } } -pub mod api_management_service { +pub mod certificate { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn restore( - &self, - resource_group_name: impl Into, - service_name: impl Into, - parameters: impl Into, - subscription_id: impl Into, - ) -> restore::Builder { - restore::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn backup( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, subscription_id: impl Into, - ) -> backup::Builder { - backup::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - parameters: parameters.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, + certificate_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(), + certificate_id: certificate_id.into(), subscription_id: subscription_id.into(), } } @@ -5307,108 +12913,55 @@ pub mod api_management_service { &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + certificate_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(), + certificate_id: certificate_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_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(), - service_name: service_name.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, + certificate_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(), + certificate_id: certificate_id.into(), + if_match: if_match.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 fn get_sso_token( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> get_sso_token::Builder { - get_sso_token::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - subscription_id: subscription_id.into(), - } - } - 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 apply_network_configuration_updates( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, + certificate_id: impl Into, subscription_id: impl Into, - ) -> apply_network_configuration_updates::Builder { - apply_network_configuration_updates::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + certificate_id: certificate_id.into(), subscription_id: subscription_id.into(), - parameters: None, } } } - pub mod restore { + pub mod list_by_service { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -5436,99 +12989,28 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - 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/{}/restore", - 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", "2019-12-01"); - 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::ApiManagementServiceResource = - 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 fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self } - } - } - pub mod backup { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ApiManagementServiceResource), - 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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) parameters: models::ApiManagementServiceBackupRestoreParameters, - pub(crate) subscription_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/backup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -5536,7 +13018,7 @@ pub mod api_management_service { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5544,8 +13026,16 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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(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)?; @@ -5553,11 +13043,10 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = + let rsp_value: models::CertificateCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(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 = @@ -5601,19 +13090,19 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) certificate_id: String, 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.ApiManagement/service/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.certificate_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -5633,7 +13122,7 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = + let rsp_value: models::CertificateContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -5655,9 +13144,8 @@ pub mod api_management_service { use super::models; #[derive(Debug)] pub enum Response { - Ok200(models::ApiManagementServiceResource), - Created201(models::ApiManagementServiceResource), - Accepted202, + Created201(models::CertificateContract), + Ok200(models::CertificateContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5686,18 +13174,25 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceResource, + pub(crate) certificate_id: String, + pub(crate) parameters: models::CertificateCreateOrUpdateParameters, 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/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.certificate_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -5711,24 +13206,26 @@ pub mod api_management_service { url.query_pairs_mut().append_pair("api-version", "2019-12-01"); 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::OK => { + http::StatusCode::CREATED => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = + let rsp_value: models::CertificateContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(Response::Created201(rsp_value)) } - http::StatusCode::CREATED => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = + let rsp_value: models::CertificateContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Created201(rsp_value)) + 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 = @@ -5743,12 +13240,12 @@ pub mod api_management_service { } } } - pub mod update { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, + Ok200, + NoContent204, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5777,22 +13274,24 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceUpdateParameters, + pub(crate) certificate_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/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.certificate_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5800,20 +13299,15 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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.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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = - 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::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 = @@ -5828,14 +13322,8 @@ pub mod api_management_service { } } } - pub mod delete { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202(models::ApiManagementServiceResource), - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -5863,21 +13351,23 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) certificate_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.certificate_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5891,14 +13381,7 @@ pub mod api_management_service { let rsp = 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::ApiManagementServiceResource = - 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), + 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 = @@ -5913,7 +13396,71 @@ pub mod api_management_service { } } } - pub mod list_by_resource_group { +} +pub mod content_type { + use super::models; + 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(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + content_type_id: 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(), + content_type_id: content_type_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + content_type_id: 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(), + content_type_id: content_type_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + content_type_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(), + content_type_id: content_type_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5941,18 +13488,18 @@ pub mod api_management_service { 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, } 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.ApiManagement/service", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes", self.client.endpoint(), &self.subscription_id, - &self.resource_group_name + &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(); @@ -5972,7 +13519,7 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceListResult = + let rsp_value: models::ContentTypeCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -5990,12 +13537,20 @@ pub mod api_management_service { } } } - pub mod list { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ContentTypeContract), + Ok200(models::ContentTypeContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -6014,21 +13569,25 @@ pub mod api_management_service { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) content_type_id: String, 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.ApiManagement/service", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", self.client.endpoint(), - &self.subscription_id + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.content_type_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6042,17 +13601,25 @@ pub mod api_management_service { let 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::ContentTypeContract = + 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::ApiManagementServiceListResult = + let rsp_value: models::ContentTypeContract = 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)?; - Err(Error::UnexpectedResponse { + 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, - body: rsp_body, + value: rsp_value, }) } } @@ -6060,7 +13627,7 @@ pub mod api_management_service { } } } - pub mod get_sso_token { + pub mod delete { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6089,24 +13656,23 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) content_type_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/getssotoken", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.content_type_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6115,18 +13681,12 @@ pub mod api_management_service { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); 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::ApiManagementServiceGetSsoTokenResult = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -6141,7 +13701,7 @@ pub mod api_management_service { } } } - pub mod check_name_availability { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6168,23 +13728,25 @@ pub mod api_management_service { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) parameters: models::ApiManagementServiceCheckNameAvailabilityParameters, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) content_type_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.ApiManagement/checkNameAvailability", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", self.client.endpoint(), - &self.subscription_id + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.content_type_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6192,19 +13754,13 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceNameAvailabilityResult = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -6219,13 +13775,29 @@ pub mod api_management_service { } } } - pub mod apply_network_configuration_updates { - use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Ok200(models::ApiManagementServiceResource), +} +pub mod content_types { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + content_type_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(), + content_type_id: content_type_id.into(), + subscription_id: subscription_id.into(), + } } + } + pub mod get { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6253,20 +13825,23 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) content_type_id: 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> { + 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/{}/applynetworkconfigurationupdates" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.content_type_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6274,23 +13849,17 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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 - }; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ApiManagementServiceResource = + let rsp_value: models::ContentTypeContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -6307,7 +13876,7 @@ pub mod api_management_service { } } } -pub mod diagnostic { +pub mod content_item { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -6315,30 +13884,31 @@ pub mod diagnostic { &self, resource_group_name: impl Into, service_name: impl Into, + content_type_id: 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(), + content_type_id: content_type_id.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, - diagnostic_id: impl Into, + content_type_id: impl Into, + content_item_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(), - diagnostic_id: diagnostic_id.into(), + content_type_id: content_type_id.into(), + content_item_id: content_item_id.into(), subscription_id: subscription_id.into(), } } @@ -6346,36 +13916,16 @@ pub mod diagnostic { &self, resource_group_name: impl Into, service_name: impl Into, - diagnostic_id: impl Into, - parameters: impl Into, + content_type_id: impl Into, + content_item_id: 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(), - diagnostic_id: diagnostic_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - diagnostic_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - diagnostic_id: diagnostic_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), + content_type_id: content_type_id.into(), + content_item_id: content_item_id.into(), subscription_id: subscription_id.into(), } } @@ -6383,16 +13933,16 @@ pub mod diagnostic { &self, resource_group_name: impl Into, service_name: impl Into, - diagnostic_id: impl Into, - if_match: impl Into, + content_type_id: impl Into, + content_item_id: 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(), - diagnostic_id: diagnostic_id.into(), - if_match: if_match.into(), + content_type_id: content_type_id.into(), + content_item_id: content_item_id.into(), subscription_id: subscription_id.into(), } } @@ -6400,14 +13950,16 @@ pub mod diagnostic { &self, resource_group_name: impl Into, service_name: impl Into, - diagnostic_id: impl Into, + content_type_id: impl Into, + content_item_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(), - diagnostic_id: diagnostic_id.into(), + content_type_id: content_type_id.into(), + content_item_id: content_item_id.into(), subscription_id: subscription_id.into(), } } @@ -6441,32 +13993,19 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) content_type_id: 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> { + 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/{}/diagnostics", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.content_type_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -6478,15 +14017,6 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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)?; @@ -6495,7 +14025,7 @@ pub mod diagnostic { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DiagnosticCollection = + let rsp_value: models::ContentItemCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -6542,20 +14072,14 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, + pub(crate) content_type_id: String, + pub(crate) content_item_id: String, 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.ApiManagement/service/{}/diagnostics/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.diagnostic_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_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); @@ -6574,7 +14098,7 @@ pub mod diagnostic { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DiagnosticContract = + let rsp_value: models::ContentItemContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -6596,8 +14120,8 @@ pub mod diagnostic { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::DiagnosticContract), - Ok200(models::DiagnosticContract), + Created201(models::ContentItemContract), + Ok200(models::ContentItemContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6626,26 +14150,14 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, - pub(crate) parameters: models::DiagnosticContract, + pub(crate) content_type_id: String, + pub(crate) content_item_id: String, 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/{}/diagnostics/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.diagnostic_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_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); @@ -6656,11 +14168,7 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -6668,13 +14176,13 @@ pub mod diagnostic { 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::DiagnosticContract = + let rsp_value: models::ContentItemContract = 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::DiagnosticContract = + let rsp_value: models::ContentItemContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -6692,7 +14200,75 @@ pub mod diagnostic { } } } - pub mod update { + pub mod delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) content_type_id: String, + pub(crate) content_item_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/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6721,25 +14297,17 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, - pub(crate) parameters: models::DiagnosticContract, - pub(crate) if_match: String, + pub(crate) content_type_id: String, + pub(crate) content_item_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/{}/diagnostics/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.diagnostic_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6747,15 +14315,13 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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.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::NO_CONTENT => Ok(()), + 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 = @@ -6770,20 +14336,21 @@ pub mod diagnostic { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, +} +pub mod api_management_operations { + use super::models; + 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; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -6802,26 +14369,14 @@ pub mod diagnostic { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) diagnostic_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> { + 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/{}/diagnostics/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.diagnostic_id - ); + let url_str = &format!("{}/providers/Microsoft.ApiManagement/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::DELETE); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6829,22 +14384,23 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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 => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ErrorResponse = + let rsp_value: models::OperationListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { status_code, - value: rsp_value, + body: rsp_body, }) } } @@ -6852,7 +14408,27 @@ pub mod diagnostic { } } } - pub mod get_entity_tag { +} +pub mod api_management_service_skus { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets available SKUs for API Management service"] + pub fn list_available_service_skus( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_available_service_skus::Builder { + list_available_service_skus::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_available_service_skus { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6881,23 +14457,21 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/skus", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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::HEAD); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6911,7 +14485,12 @@ pub mod diagnostic { let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceSkuResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -6927,38 +14506,50 @@ pub mod diagnostic { } } } -pub mod email_template { +pub mod api_management_service { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_service( + pub fn restore( &self, resource_group_name: impl Into, service_name: impl Into, + parameters: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> restore::Builder { + restore::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn backup( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> backup::Builder { + backup::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.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, - template_name: 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(), - template_name: template_name.into(), subscription_id: subscription_id.into(), } } @@ -6966,36 +14557,29 @@ pub mod email_template { &self, resource_group_name: impl Into, service_name: impl Into, - template_name: impl Into, - parameters: 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(), - template_name: template_name.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), - if_match: None, } } pub fn update( &self, resource_group_name: impl Into, service_name: impl Into, - template_name: impl Into, - parameters: impl Into, - if_match: impl Into, + parameters: impl Into, subscription_id: impl Into, ) -> update::Builder { update::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - template_name: template_name.into(), parameters: parameters.into(), - if_match: if_match.into(), subscription_id: subscription_id.into(), } } @@ -7003,37 +14587,163 @@ pub mod email_template { &self, resource_group_name: impl Into, service_name: impl Into, - template_name: 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(), - template_name: template_name.into(), - if_match: if_match.into(), subscription_id: subscription_id.into(), } } - pub fn get_entity_tag( + 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 fn get_sso_token( &self, resource_group_name: impl Into, service_name: impl Into, - template_name: impl Into, subscription_id: impl Into, - ) -> get_entity_tag::Builder { - get_entity_tag::Builder { + ) -> get_sso_token::Builder { + get_sso_token::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + 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 apply_network_configuration_updates( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> apply_network_configuration_updates::Builder { + apply_network_configuration_updates::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - template_name: template_name.into(), subscription_id: subscription_id.into(), + parameters: None, + } + } + } + pub mod restore { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + 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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) parameters: models::ApiManagementServiceBackupRestoreParameters, + pub(crate) subscription_id: String, + } + impl Builder { + 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/{}/restore", + 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", "2019-12-01"); + 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::ApiManagementServiceResource = + 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 list_by_service { + pub mod backup { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7061,28 +14771,14 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, 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> { + 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/{}/templates", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backup", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -7090,7 +14786,7 @@ pub mod email_template { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7098,16 +14794,8 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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.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)?; @@ -7115,10 +14803,11 @@ pub mod email_template { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateCollection = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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 = @@ -7162,19 +14851,19 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, 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.ApiManagement/service/{}/templates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.template_name + &self.service_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -7194,7 +14883,7 @@ pub mod email_template { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateContract = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -7216,8 +14905,9 @@ pub mod email_template { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::EmailTemplateContract), - Ok200(models::EmailTemplateContract), + Ok200(models::ApiManagementServiceResource), + Created201(models::ApiManagementServiceResource), + Accepted202, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7246,25 +14936,18 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, - pub(crate) parameters: models::EmailTemplateUpdateParameters, + pub(crate) parameters: models::ApiManagementServiceResource, 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/{}/templates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.template_name + &self.service_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -7278,26 +14961,24 @@ pub mod email_template { url.query_pairs_mut().append_pair("api-version", "2019-12-01"); 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 => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateContract = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Created201(rsp_value)) + Ok(Response::Ok200(rsp_value)) } - http::StatusCode::OK => { + http::StatusCode::CREATED => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateContract = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + 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 = @@ -7314,6 +14995,11 @@ pub mod email_template { } pub mod update { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7341,21 +15027,18 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, - pub(crate) parameters: models::EmailTemplateUpdateParameters, - pub(crate) if_match: String, + pub(crate) parameters: models::ApiManagementServiceUpdateParameters, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/templates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.template_name + &self.service_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -7369,13 +15052,18 @@ pub mod email_template { url.query_pairs_mut().append_pair("api-version", "2019-12-01"); 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.header("If-Match", &self.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::NO_CONTENT => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceResource = + 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 = @@ -7395,6 +15083,7 @@ pub mod email_template { #[derive(Debug)] pub enum Response { Ok200, + Accepted202(models::ApiManagementServiceResource), NoContent204, } #[derive(Debug, thiserror :: Error)] @@ -7424,20 +15113,17 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: 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/{}/templates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.template_name + &self.service_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -7449,7 +15135,6 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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)?; @@ -7457,6 +15142,12 @@ pub mod email_template { 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::ApiManagementServiceResource = + 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)?; @@ -7472,15 +15163,89 @@ pub mod email_template { } } } - pub mod get_entity_tag { + pub mod list_by_resource_group { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.ApiManagement/service", + 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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -7499,25 +15264,21 @@ pub mod email_template { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) template_name: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/templates/{}", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/service", self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.template_name + &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::HEAD); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7531,14 +15292,17 @@ pub mod email_template { let rsp = 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 => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ErrorResponse = + let rsp_value: models::ApiManagementServiceListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { status_code, - value: rsp_value, + body: rsp_body, }) } } @@ -7546,161 +15310,7 @@ pub mod email_template { } } } -} -pub mod gateway { - use super::models; - 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(), - top: None, - skip: None, - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_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(), - gateway_id: gateway_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_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(), - gateway_id: gateway_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - gateway_id: gateway_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_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(), - gateway_id: gateway_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, - gateway_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(), - gateway_id: gateway_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_keys( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - subscription_id: impl Into, - ) -> list_keys::Builder { - list_keys::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - gateway_id: gateway_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn regenerate_key( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> regenerate_key::Builder { - regenerate_key::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - gateway_id: gateway_id.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - pub fn generate_token( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - parameters: impl Into, - subscription_id: impl Into, - ) -> generate_token::Builder { - generate_token::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - gateway_id: gateway_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod get_sso_token { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7730,22 +15340,15 @@ pub mod gateway { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) subscription_id: String, - pub(crate) top: Option, - pub(crate) skip: Option, } impl Builder { - 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> { + 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/{}/gateways", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/getssotoken", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -7753,7 +15356,7 @@ pub mod gateway { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7761,13 +15364,8 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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.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)?; @@ -7775,7 +15373,7 @@ pub mod gateway { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayCollection = + let rsp_value: models::ApiManagementServiceGetSsoTokenResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -7793,7 +15391,7 @@ pub mod gateway { } } } - pub mod get { + pub mod check_name_availability { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7820,25 +15418,23 @@ pub mod gateway { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) gateway_id: String, + pub(crate) parameters: models::ApiManagementServiceCheckNameAvailabilityParameters, 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.ApiManagement/service/{}/gateways/{}", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/checkNameAvailability", self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.gateway_id + &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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7846,7 +15442,8 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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)?; @@ -7854,7 +15451,7 @@ pub mod gateway { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayContract = + let rsp_value: models::ApiManagementServiceNameAvailabilityResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -7872,12 +15469,12 @@ pub mod gateway { } } } - pub mod create_or_update { + pub mod apply_network_configuration_updates { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::GatewayContract), - Ok200(models::GatewayContract), + Accepted202, + Ok200(models::ApiManagementServiceResource), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7906,29 +15503,20 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) parameters: models::GatewayContract, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) parameters: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + 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.ApiManagement/service/{}/gateways/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.gateway_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/applynetworkconfigurationupdates" , 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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7936,25 +15524,21 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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); - } + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayContract = - 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), http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayContract = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -7972,7 +15556,113 @@ pub mod gateway { } } } - pub mod update { +} +pub mod diagnostic { + use super::models; + 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, + diagnostic_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(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + diagnostic_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(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + diagnostic_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + diagnostic_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(), + diagnostic_id: diagnostic_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, + diagnostic_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(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8001,25 +15691,36 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) parameters: models::GatewayContract, - pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.gateway_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8027,15 +15728,27 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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.header("If-Match", &self.if_match); + 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::NO_CONTENT => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -8050,13 +15763,8 @@ pub mod gateway { } } } - pub mod delete { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8084,24 +15792,23 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) if_match: String, + pub(crate) diagnostic_id: String, 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.ApiManagement/service/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8109,15 +15816,18 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -8132,8 +15842,13 @@ pub mod gateway { } } } - pub mod get_entity_tag { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::DiagnosticContract), + Ok200(models::DiagnosticContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8161,23 +15876,29 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8185,13 +15906,28 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(()), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + 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::DiagnosticContract = + 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 = @@ -8206,7 +15942,7 @@ pub mod gateway { } } } - pub mod list_keys { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8235,23 +15971,25 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + pub(crate) if_match: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/listKeys", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8259,19 +15997,15 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + 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.header("If-Match", &self.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::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayKeysContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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::ErrorResponse = @@ -8286,8 +16020,13 @@ pub mod gateway { } } } - pub mod regenerate_key { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8315,24 +16054,24 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, + pub(crate) diagnostic_id: String, + pub(crate) if_match: String, pub(crate) subscription_id: String, - pub(crate) parameters: models::GatewayKeyRegenerationRequestContract, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/gateways/{}/regenerateKey", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8340,14 +16079,15 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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.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::NO_CONTENT => Ok(()), + 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 = @@ -8362,7 +16102,7 @@ pub mod gateway { } } } - pub mod generate_token { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8391,24 +16131,23 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) parameters: models::GatewayTokenRequestContract, + pub(crate) diagnostic_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/generateToken", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8416,19 +16155,13 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayTokenContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -8444,7 +16177,7 @@ pub mod gateway { } } } -pub mod gateway_hostname_configuration { +pub mod email_template { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -8452,15 +16185,14 @@ pub mod gateway_hostname_configuration { &self, resource_group_name: impl Into, service_name: impl Into, - gateway_id: 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(), - gateway_id: gateway_id.into(), subscription_id: subscription_id.into(), + filter: None, top: None, skip: None, } @@ -8469,16 +16201,14 @@ pub mod gateway_hostname_configuration { &self, resource_group_name: impl Into, service_name: impl Into, - gateway_id: impl Into, - hc_id: impl Into, + template_name: 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(), - gateway_id: gateway_id.into(), - hc_id: hc_id.into(), + template_name: template_name.into(), subscription_id: subscription_id.into(), } } @@ -8486,35 +16216,53 @@ pub mod gateway_hostname_configuration { &self, resource_group_name: impl Into, service_name: impl Into, - gateway_id: impl Into, - hc_id: impl Into, + template_name: impl Into, + parameters: impl Into, subscription_id: impl Into, - parameters: 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(), - gateway_id: gateway_id.into(), - hc_id: hc_id.into(), + template_name: template_name.into(), + parameters: parameters.into(), subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + template_name: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + template_name: template_name.into(), parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), } } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - gateway_id: impl Into, - hc_id: impl Into, + template_name: 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(), - gateway_id: gateway_id.into(), - hc_id: hc_id.into(), + template_name: template_name.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } @@ -8522,16 +16270,14 @@ pub mod gateway_hostname_configuration { &self, resource_group_name: impl Into, service_name: impl Into, - gateway_id: impl Into, - hc_id: impl Into, + template_name: 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(), - gateway_id: gateway_id.into(), - hc_id: hc_id.into(), + template_name: template_name.into(), subscription_id: subscription_id.into(), } } @@ -8565,12 +16311,16 @@ pub mod gateway_hostname_configuration { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: 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 @@ -8579,12 +16329,15 @@ pub mod gateway_hostname_configuration { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/gateways/{}/hostnameConfigurations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates", + 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); @@ -8595,6 +16348,9 @@ pub mod gateway_hostname_configuration { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); + 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()); } @@ -8609,7 +16365,7 @@ pub mod gateway_hostname_configuration { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayHostnameConfigurationCollection = + let rsp_value: models::EmailTemplateCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -8656,19 +16412,113 @@ pub mod gateway_hostname_configuration { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) hc_id: String, + pub(crate) template_name: String, 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.ApiManagement/service/{}/templates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EmailTemplateContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::EmailTemplateContract), + Ok200(models::EmailTemplateContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) template_name: String, + pub(crate) parameters: models::EmailTemplateUpdateParameters, + 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/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8676,17 +16526,27 @@ pub mod gateway_hostname_configuration { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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::EmailTemplateContract = + 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::GatewayHostnameConfigurationContract = + let rsp_value: models::EmailTemplateContract = 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)?; @@ -8702,13 +16562,8 @@ pub mod gateway_hostname_configuration { } } } - pub mod create_or_update { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::GatewayHostnameConfigurationContract), - Ok200(models::GatewayHostnameConfigurationContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8736,18 +16591,25 @@ pub mod gateway_hostname_configuration { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) hc_id: String, + pub(crate) template_name: String, + pub(crate) parameters: models::EmailTemplateUpdateParameters, + pub(crate) if_match: String, pub(crate) subscription_id: String, - pub(crate) parameters: models::GatewayHostnameConfigurationContract, } 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<(), Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8757,23 +16619,13 @@ pub mod gateway_hostname_configuration { url.query_pairs_mut().append_pair("api-version", "2019-12-01"); 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.header("If-Match", &self.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::GatewayHostnameConfigurationContract = - 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::GatewayHostnameConfigurationContract = - 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(()), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -8822,14 +16674,21 @@ pub mod gateway_hostname_configuration { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) hc_id: String, + pub(crate) template_name: 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/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.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); @@ -8840,6 +16699,7 @@ pub mod gateway_hostname_configuration { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); + 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)?; @@ -8891,14 +16751,20 @@ pub mod gateway_hostname_configuration { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) hc_id: String, + pub(crate) template_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.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.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::HEAD); @@ -8931,7 +16797,7 @@ pub mod gateway_hostname_configuration { } } } -pub mod gateway_api { +pub mod gateway { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -8939,25 +16805,38 @@ pub mod gateway_api { &self, resource_group_name: impl Into, service_name: impl Into, - gateway_id: 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(), - gateway_id: gateway_id.into(), subscription_id: subscription_id.into(), top: None, skip: None, } } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_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(), + gateway_id: gateway_id.into(), + subscription_id: subscription_id.into(), + } + } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - api_id: impl Into, + parameters: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -8965,9 +16844,28 @@ pub mod gateway_api { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - api_id: api_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), - parameters: None, } } pub fn delete( @@ -8975,7 +16873,7 @@ pub mod gateway_api { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - api_id: impl Into, + if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { delete::Builder { @@ -8983,7 +16881,7 @@ pub mod gateway_api { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - api_id: api_id.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } @@ -8992,7 +16890,6 @@ pub mod gateway_api { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - api_id: impl Into, subscription_id: impl Into, ) -> get_entity_tag::Builder { get_entity_tag::Builder { @@ -9000,113 +16897,61 @@ pub mod gateway_api { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - api_id: api_id.into(), subscription_id: subscription_id.into(), } } - } - pub mod list_by_service { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) gateway_id: String, - pub(crate) subscription_id: String, - pub(crate) top: Option, - pub(crate) skip: Option, - } - impl Builder { - 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 list_keys( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + subscription_id: impl Into, + ) -> list_keys::Builder { + list_keys::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + subscription_id: subscription_id.into(), } - 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/{}/gateways/{}/apis", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.gateway_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", "2019-12-01"); - 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::ApiCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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 regenerate_key( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> regenerate_key::Builder { + regenerate_key::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + pub fn generate_token( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> generate_token::Builder { + generate_token::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), } } } - pub mod create_or_update { + pub mod list_by_service { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ApiContract), - Ok200(models::ApiContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9134,30 +16979,31 @@ pub mod gateway_api { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) api_id: String, pub(crate) subscription_id: String, - pub(crate) parameters: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn parameters(mut self, parameters: impl Into) -> Self { - self.parameters = Some(parameters.into()); + 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> { + 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/{}/gateways/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.gateway_id, - &self.api_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9165,28 +17011,23 @@ pub mod gateway_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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 - }; + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiContract = - 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::ApiContract = + let rsp_value: models::GatewayCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -9202,13 +17043,8 @@ pub mod gateway_api { } } } - pub mod delete { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9237,24 +17073,22 @@ pub mod gateway_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) api_id: String, 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.ApiManagement/service/{}/gateways/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id, - &self.api_id + &self.gateway_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9268,8 +17102,12 @@ pub mod gateway_api { let rsp = 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -9284,8 +17122,13 @@ pub mod gateway_api { } } } - pub mod get_entity_tag { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::GatewayContract), + Ok200(models::GatewayContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9314,24 +17157,28 @@ pub mod gateway_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) api_id: String, + pub(crate) parameters: models::GatewayContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/gateways/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id, - &self.api_id + &self.gateway_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9339,134 +17186,43 @@ pub mod gateway_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = 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 group { - use super::models; - 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, - group_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(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - group_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(), - group_id: group_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - group_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - group_id: group_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - group_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(), - group_id: group_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, - group_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(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), + 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::GatewayContract = + 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::GatewayContract = + 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 list_by_service { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9495,36 +17251,25 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) gateway_id: String, + pub(crate) parameters: models::GatewayContract, + pub(crate) if_match: 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> { + 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/{}/groups", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.gateway_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9532,27 +17277,15 @@ pub mod group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.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::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GroupCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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::ErrorResponse = @@ -9567,8 +17300,13 @@ pub mod group { } } } - pub mod get { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9596,23 +17334,24 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, + pub(crate) gateway_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> { + 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/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.gateway_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9620,18 +17359,15 @@ pub mod group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GroupContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -9646,13 +17382,8 @@ pub mod group { } } } - pub mod create_or_update { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::GroupContract), - Ok200(models::GroupContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9680,29 +17411,23 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) parameters: models::GroupCreateParameters, + pub(crate) gateway_id: String, 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> { + 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/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.gateway_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9710,28 +17435,13 @@ pub mod group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::GroupContract = - 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::GroupContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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 = @@ -9746,7 +17456,7 @@ pub mod group { } } } - pub mod update { + pub mod list_keys { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9775,25 +17485,23 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) parameters: models::GroupUpdateParameters, - pub(crate) if_match: String, + pub(crate) gateway_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/listKeys", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.gateway_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9801,15 +17509,19 @@ pub mod group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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.header("If-Match", &self.if_match); + 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayKeysContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -9824,13 +17536,8 @@ pub mod group { } } } - pub mod delete { + pub mod regenerate_key { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9858,24 +17565,24 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) if_match: String, + pub(crate) gateway_id: String, pub(crate) subscription_id: String, + pub(crate) parameters: models::GatewayKeyRegenerationRequestContract, } 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/regenerateKey", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.gateway_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9883,15 +17590,14 @@ pub mod group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - req_builder = req_builder.header("If-Match", &self.if_match); - let req_body = azure_core::EMPTY_BODY; + 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::NO_CONTENT => Ok(Response::NoContent204), + 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::ErrorResponse = @@ -9906,7 +17612,7 @@ pub mod group { } } } - pub mod get_entity_tag { + pub mod generate_token { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9935,23 +17641,24 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, + pub(crate) gateway_id: String, + pub(crate) parameters: models::GatewayTokenRequestContract, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/generateToken", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.gateway_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9959,13 +17666,19 @@ pub mod group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayTokenContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -9981,81 +17694,99 @@ pub mod group { } } } -pub mod group_user { +pub mod gateway_hostname_configuration { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, + gateway_id: impl Into, subscription_id: impl Into, - ) -> list::Builder { - list::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - group_id: group_id.into(), + gateway_id: gateway_id.into(), subscription_id: subscription_id.into(), - filter: None, top: None, skip: None, } } - pub fn create( + pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - user_id: impl Into, + gateway_id: impl Into, + hc_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(), + gateway_id: gateway_id.into(), + hc_id: hc_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + hc_id: impl Into, subscription_id: impl Into, - ) -> create::Builder { - create::Builder { + parameters: 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(), - group_id: group_id.into(), - user_id: user_id.into(), + gateway_id: gateway_id.into(), + hc_id: hc_id.into(), subscription_id: subscription_id.into(), + parameters: parameters.into(), } } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - user_id: impl Into, + gateway_id: impl Into, + hc_id: 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(), - group_id: group_id.into(), - user_id: user_id.into(), + gateway_id: gateway_id.into(), + hc_id: hc_id.into(), subscription_id: subscription_id.into(), } } - pub fn check_entity_exists( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - user_id: impl Into, + gateway_id: impl Into, + hc_id: impl Into, subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - group_id: group_id.into(), - user_id: user_id.into(), + gateway_id: gateway_id.into(), + hc_id: hc_id.into(), subscription_id: subscription_id.into(), } } } - pub mod list { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -10084,17 +17815,12 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, + pub(crate) gateway_id: 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 @@ -10103,16 +17829,12 @@ pub mod group_user { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/groups/{}/users", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_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); @@ -10123,9 +17845,6 @@ pub mod group_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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()); } @@ -10140,7 +17859,7 @@ pub mod group_user { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::UserCollection = + let rsp_value: models::GatewayHostnameConfigurationCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -10158,12 +17877,87 @@ pub mod group_user { } } } - pub mod create { + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) gateway_id: String, + pub(crate) hc_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/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayHostnameConfigurationContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; #[derive(Debug)] pub enum Response { - Created201(models::UserContract), - Ok200(models::UserContract), + Created201(models::GatewayHostnameConfigurationContract), + Ok200(models::GatewayHostnameConfigurationContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -10192,22 +17986,15 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) user_id: String, + pub(crate) gateway_id: String, + pub(crate) hc_id: String, pub(crate) subscription_id: String, + pub(crate) parameters: models::GatewayHostnameConfigurationContract, } impl Builder { 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/{}/groups/{}/users/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id, - &self.user_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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); @@ -10218,7 +18005,8 @@ pub mod group_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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)?; @@ -10226,13 +18014,13 @@ pub mod group_user { 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::UserContract = + let rsp_value: models::GatewayHostnameConfigurationContract = 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::UserContract = + let rsp_value: models::GatewayHostnameConfigurationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -10284,22 +18072,14 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) user_id: String, + pub(crate) gateway_id: String, + pub(crate) hc_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/{}/groups/{}/users/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id, - &self.user_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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); @@ -10332,12 +18112,10 @@ pub mod group_user { } } } - pub mod check_entity_exists { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Error response #response_type")] - NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -10363,22 +18141,14 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) user_id: String, + pub(crate) gateway_id: String, + pub(crate) hc_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/{}/groups/{}/users/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id, - &self.user_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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); @@ -10395,8 +18165,7 @@ pub mod group_user { let 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(()), - http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + 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 = @@ -10412,7 +18181,7 @@ pub mod group_user { } } } -pub mod identity_provider { +pub mod gateway_api { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -10420,111 +18189,68 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, + gateway_id: 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(), + gateway_id: gateway_id.into(), subscription_id: subscription_id.into(), + top: None, + skip: None, } } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - identity_provider_name: 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(), - identity_provider_name: identity_provider_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - identity_provider_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(), - service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - identity_provider_name: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( + pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, - if_match: impl Into, + gateway_id: impl Into, + api_id: impl Into, subscription_id: impl Into, - ) -> delete::Builder { - delete::Builder { + ) -> create_or_update::Builder { + create_or_update::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), - if_match: if_match.into(), + gateway_id: gateway_id.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), + parameters: None, } } - pub fn get_entity_tag( + pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, + gateway_id: impl Into, + api_id: impl Into, subscription_id: impl Into, - ) -> get_entity_tag::Builder { - get_entity_tag::Builder { + ) -> delete::Builder { + delete::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), + gateway_id: gateway_id.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), } } - pub fn list_secrets( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, + gateway_id: impl Into, + api_id: impl Into, subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), + gateway_id: gateway_id.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), } } @@ -10558,17 +18284,29 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) gateway_id: String, pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/identityProviders", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.gateway_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -10580,6 +18318,12 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); + 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)?; @@ -10588,7 +18332,7 @@ pub mod identity_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IdentityProviderList = + let rsp_value: models::ApiCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -10606,8 +18350,13 @@ pub mod identity_provider { } } } - pub mod get { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ApiContract), + Ok200(models::ApiContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -10635,23 +18384,30 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, + pub(crate) gateway_id: String, + pub(crate) api_id: String, pub(crate) subscription_id: String, + pub(crate) parameters: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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.ApiManagement/service/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.gateway_id, + &self.api_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -10659,17 +18415,28 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiContract = + 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::IdentityProviderContract = + let rsp_value: models::ApiContract = 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)?; @@ -10685,12 +18452,12 @@ pub mod identity_provider { } } } - pub mod create_or_update { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::IdentityProviderContract), - Ok200(models::IdentityProviderContract), + Ok200, + NoContent204, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -10719,29 +18486,25 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, - pub(crate) parameters: models::IdentityProviderCreateContract, + pub(crate) gateway_id: String, + pub(crate) api_id: String, 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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.gateway_id, + &self.api_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -10749,28 +18512,14 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::IdentityProviderContract = - 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::IdentityProviderContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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 = @@ -10785,7 +18534,7 @@ pub mod identity_provider { } } } - pub mod update { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -10814,25 +18563,25 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, - pub(crate) parameters: models::IdentityProviderUpdateParameters, - pub(crate) if_match: String, + pub(crate) gateway_id: String, + pub(crate) api_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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.gateway_id, + &self.api_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -10840,15 +18589,13 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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.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::NO_CONTENT => Ok(()), + 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 = @@ -10863,13 +18610,114 @@ pub mod identity_provider { } } } - pub mod delete { +} +pub mod group { + use super::models; + 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, + group_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(), + group_id: group_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_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(), + group_id: group_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_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(), + group_id: group_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, + group_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(), + group_id: group_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -10897,24 +18745,36 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, - pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.identity_provider_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -10922,15 +18782,27 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - req_builder = req_builder.header("If-Match", &self.if_match); + 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 => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GroupCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -10945,7 +18817,7 @@ pub mod identity_provider { } } } - pub mod get_entity_tag { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -10974,90 +18846,23 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, + pub(crate) group_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.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::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", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = 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_secrets { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) identity_provider_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.ApiManagement/service/{}/identityProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . identity_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11066,7 +18871,6 @@ pub mod identity_provider { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); 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)?; @@ -11074,7 +18878,7 @@ pub mod identity_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ClientSecretContract = + let rsp_value: models::GroupContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -11092,45 +18896,13 @@ pub mod identity_provider { } } } -} -pub mod issue { - use super::models; - 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, - issue_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(), - issue_id: issue_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::GroupContract), + Ok200(models::GroupContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -11158,36 +18930,29 @@ pub mod issue { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) group_id: String, + pub(crate) parameters: models::GroupCreateParameters, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, + pub(crate) if_match: 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); + 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> { + 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/{}/issues", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11195,26 +18960,27 @@ pub mod issue { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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()); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::GroupContract = + 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::IssueCollection = + let rsp_value: models::GroupContract = 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)?; @@ -11230,7 +18996,7 @@ pub mod issue { } } } - pub mod get { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11259,23 +19025,25 @@ pub mod issue { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) issue_id: String, + pub(crate) group_id: String, + pub(crate) parameters: models::GroupUpdateParameters, + pub(crate) if_match: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/issues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.issue_id + &self.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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11283,18 +19051,15 @@ pub mod issue { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IssueContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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::ErrorResponse = @@ -11309,115 +19074,13 @@ pub mod issue { } } } -} -pub mod logger { - use super::models; - 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, - logger_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(), - logger_id: logger_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - logger_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(), - logger_id: logger_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - logger_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - logger_id: logger_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - logger_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(), - logger_id: logger_id.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - force: None, - } - } - pub fn get_entity_tag( - &self, - resource_group_name: impl Into, - service_name: impl Into, - logger_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(), - logger_id: logger_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -11445,36 +19108,24 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) group_id: String, + pub(crate) if_match: 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> { + 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/{}/loggers", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11482,27 +19133,15 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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()); - } + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::LoggerCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -11517,7 +19156,7 @@ pub mod logger { } } } - pub mod get { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11546,23 +19185,23 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, + pub(crate) group_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11576,12 +19215,7 @@ pub mod logger { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::LoggerContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -11596,13 +19230,83 @@ pub mod logger { } } } - pub mod create_or_update { +} +pub mod group_user { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn create( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + user_id: 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(), + group_id: group_id.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::LoggerContract), - Ok200(models::LoggerContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -11630,29 +19334,38 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, - pub(crate) parameters: models::LoggerContract, + pub(crate) group_id: String, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + 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> { + 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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.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::PUT); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11660,27 +19373,26 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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); + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::LoggerContract = - 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::LoggerContract = + let rsp_value: models::UserCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -11696,8 +19408,13 @@ pub mod logger { } } } - pub mod update { + pub mod create { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::UserContract), + Ok200(models::UserContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -11725,25 +19442,25 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, - pub(crate) parameters: models::LoggerUpdateContract, - pub(crate) if_match: String, + pub(crate) group_id: String, + pub(crate) user_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.group_id, + &self.user_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11751,15 +19468,24 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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.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::NO_CONTENT => Ok(()), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UserContract = + 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::UserContract = + 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 = @@ -11808,25 +19534,21 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, - pub(crate) if_match: String, + pub(crate) group_id: String, + pub(crate) user_id: String, pub(crate) subscription_id: String, - pub(crate) force: Option, } impl Builder { - pub fn force(mut self, force: bool) -> Self { - self.force = Some(force); - 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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.group_id, + &self.user_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -11838,10 +19560,6 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - req_builder = req_builder.header("If-Match", &self.if_match); - if let Some(force) = &self.force { - url.query_pairs_mut().append_pair("force", &force.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)?; @@ -11864,10 +19582,12 @@ pub mod logger { } } } - pub mod get_entity_tag { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -11893,19 +19613,21 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, + pub(crate) group_id: String, + pub(crate) user_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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.group_id, + &self.user_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -11923,7 +19645,8 @@ pub mod logger { let rsp = 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(()), + http::StatusCode::NO_CONTENT => Ok(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -11939,7 +19662,7 @@ pub mod logger { } } } -pub mod named_value { +pub mod identity_provider { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -11954,23 +19677,20 @@ pub mod named_value { 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, - named_value_id: impl Into, + identity_provider_name: 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(), - named_value_id: named_value_id.into(), + identity_provider_name: identity_provider_name.into(), subscription_id: subscription_id.into(), } } @@ -11978,15 +19698,15 @@ pub mod named_value { &self, resource_group_name: impl Into, service_name: impl Into, - named_value_id: impl Into, - parameters: impl Into, + identity_provider_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(), service_name: service_name.into(), - named_value_id: named_value_id.into(), + identity_provider_name: identity_provider_name.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -11996,8 +19716,8 @@ pub mod named_value { &self, resource_group_name: impl Into, service_name: impl Into, - named_value_id: impl Into, - parameters: impl Into, + identity_provider_name: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -12005,7 +19725,7 @@ pub mod named_value { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - named_value_id: named_value_id.into(), + identity_provider_name: identity_provider_name.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), @@ -12015,7 +19735,7 @@ pub mod named_value { &self, resource_group_name: impl Into, service_name: impl Into, - named_value_id: impl Into, + identity_provider_name: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -12023,7 +19743,7 @@ pub mod named_value { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - named_value_id: named_value_id.into(), + identity_provider_name: identity_provider_name.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -12032,29 +19752,29 @@ pub mod named_value { &self, resource_group_name: impl Into, service_name: impl Into, - named_value_id: impl Into, + identity_provider_name: 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(), - named_value_id: named_value_id.into(), + identity_provider_name: identity_provider_name.into(), subscription_id: subscription_id.into(), } } - pub fn list_value( + pub fn list_secrets( &self, resource_group_name: impl Into, service_name: impl Into, - named_value_id: impl Into, + identity_provider_name: impl Into, subscription_id: impl Into, - ) -> list_value::Builder { - list_value::Builder { + ) -> list_secrets::Builder { + list_secrets::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - named_value_id: named_value_id.into(), + identity_provider_name: identity_provider_name.into(), subscription_id: subscription_id.into(), } } @@ -12089,31 +19809,95 @@ pub mod named_value { 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> { + 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/{}/identityProviders", + 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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IdentityProviderList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) identity_provider_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.ApiManagement/service/{}/namedValues", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.identity_provider_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -12125,15 +19909,6 @@ pub mod named_value { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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)?; @@ -12142,7 +19917,7 @@ pub mod named_value { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NamedValueCollection = + let rsp_value: models::IdentityProviderContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -12160,8 +19935,13 @@ pub mod named_value { } } } - pub mod get { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::IdentityProviderContract), + Ok200(models::IdentityProviderContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12189,23 +19969,29 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, + pub(crate) identity_provider_name: String, + pub(crate) parameters: models::IdentityProviderCreateContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/namedValues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.named_value_id + &self.identity_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12213,17 +19999,27 @@ pub mod named_value { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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::IdentityProviderContract = + 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::NamedValueContract = + let rsp_value: models::IdentityProviderContract = 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)?; @@ -12239,14 +20035,8 @@ pub mod named_value { } } } - pub mod create_or_update { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Created201(models::NamedValueContract), - Ok200(models::NamedValueContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12274,29 +20064,25 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, - pub(crate) parameters: models::NamedValueCreateContract, + pub(crate) identity_provider_name: String, + pub(crate) parameters: models::IdentityProviderUpdateParameters, + pub(crate) if_match: String, 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> { + 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/{}/namedValues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.named_value_id + &self.identity_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12306,27 +20092,169 @@ pub mod named_value { url.query_pairs_mut().append_pair("api-version", "2019-12-01"); 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.header("If-Match", &self.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::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::CREATED => { + 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::NamedValueContract = + let rsp_value: models::ErrorResponse = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Created201(rsp_value)) + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) } - http::StatusCode::OK => { + } + }) + } + } + } + pub mod delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) identity_provider_name: 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/{}/identityProviders/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.identity_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", "2019-12-01"); + 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::NamedValueContract = + let rsp_value: models::ErrorResponse = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) identity_provider_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.ApiManagement/service/{}/identityProviders/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.identity_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::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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 = @@ -12341,14 +20269,8 @@ pub mod named_value { } } } - pub mod update { + pub mod list_secrets { use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - NoContent204, - Ok200(models::NamedValueContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12376,25 +20298,16 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, - pub(crate) parameters: models::NamedValueUpdateParameters, - pub(crate) if_match: String, + pub(crate) identity_provider_name: String, 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.ApiManagement/service/{}/namedValues/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.named_value_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . identity_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::PATCH); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12402,21 +20315,18 @@ pub mod named_value { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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.header("If-Match", &self.if_match); + 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), http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NamedValueContract = + let rsp_value: models::ClientSecretContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -12432,13 +20342,45 @@ pub mod named_value { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, +} +pub mod issue { + use super::models; + 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, + issue_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(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + } } + } + pub mod list_by_service { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12466,24 +20408,36 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, - pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/namedValues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/issues", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.named_value_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12491,15 +20445,27 @@ pub mod named_value { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - req_builder = req_builder.header("If-Match", &self.if_match); + 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 => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -12514,7 +20480,7 @@ pub mod named_value { } } } - pub mod get_entity_tag { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12543,52 +20509,164 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, + pub(crate) issue_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/{}/namedValues/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.named_value_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", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = 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, - }) - } - } - }) + impl Builder { + 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/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.issue_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 logger { + use super::models; + 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, + logger_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(), + logger_id: logger_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + logger_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(), + logger_id: logger_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + logger_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + logger_id: logger_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + logger_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(), + logger_id: logger_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + force: None, + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + logger_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(), + logger_id: logger_id.into(), + subscription_id: subscription_id.into(), } } } - pub mod list_value { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12617,23 +20695,36 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/namedValues/{}/listValue", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.named_value_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12641,8 +20732,16 @@ pub mod named_value { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); + 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.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)?; @@ -12650,7 +20749,7 @@ pub mod named_value { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PropertyValueContract = + let rsp_value: models::LoggerCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -12668,41 +20767,7 @@ pub mod named_value { } } } -} -pub mod network_status { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_service( - &self, - subscription_id: impl Into, - resource_group_name: impl Into, - service_name: impl Into, - ) -> list_by_service::Builder { - list_by_service::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_by_location( - &self, - subscription_id: impl Into, - resource_group_name: impl Into, - service_name: impl Into, - location_name: impl Into, - ) -> list_by_location::Builder { - list_by_location::Builder { - client: self.0.clone(), - subscription_id: subscription_id.into(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - location_name: location_name.into(), - } - } - } - pub mod list_by_service { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12729,21 +20794,21 @@ pub mod network_status { #[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) logger_id: String, + pub(crate) subscription_id: String, } impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + 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/{}/networkstatus", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.logger_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -12763,7 +20828,7 @@ pub mod network_status { 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 = + let rsp_value: models::LoggerContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -12781,8 +20846,13 @@ pub mod network_status { } } } - pub mod list_by_location { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::LoggerContract), + Ok200(models::LoggerContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12808,25 +20878,31 @@ pub mod network_status { #[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) location_name: String, + pub(crate) logger_id: String, + pub(crate) parameters: models::LoggerContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/locations/{}/networkstatus", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.location_name + &self.logger_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12834,85 +20910,43 @@ pub mod network_status { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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::OK => { + http::StatusCode::CREATED => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NetworkStatusContract = + let rsp_value: models::LoggerContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + Ok(Response::Created201(rsp_value)) } - status_code => { + http::StatusCode::OK => { 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 notification { - use super::models; - 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(), - top: None, - skip: None, - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: 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(), - notification_name: notification_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_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(), - service_name: service_name.into(), - notification_name: notification_name.into(), - subscription_id: subscription_id.into(), - if_match: None, + let rsp_value: models::LoggerContract = + 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 list_by_service { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12941,31 +20975,25 @@ pub mod notification { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) logger_id: String, + pub(crate) parameters: models::LoggerUpdateContract, + pub(crate) if_match: String, pub(crate) subscription_id: String, - pub(crate) top: Option, - pub(crate) skip: Option, } impl Builder { - 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> { + 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/{}/notifications", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.logger_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12973,24 +21001,15 @@ pub mod notification { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.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::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NotificationCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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::ErrorResponse = @@ -13005,8 +21024,13 @@ pub mod notification { } } } - pub mod get { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13034,23 +21058,29 @@ pub mod notification { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, + pub(crate) logger_id: String, + pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) force: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn force(mut self, force: bool) -> Self { + self.force = Some(force); + 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/{}/notifications/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.notification_name + &self.logger_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13058,18 +21088,18 @@ pub mod notification { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); + req_builder = req_builder.header("If-Match", &self.if_match); + if let Some(force) = &self.force { + url.query_pairs_mut().append_pair("force", &force.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::NotificationContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -13084,7 +21114,7 @@ pub mod notification { } } } - pub mod create_or_update { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13113,28 +21143,23 @@ pub mod notification { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, + pub(crate) logger_id: String, 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> { + 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/{}/notifications/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.notification_name + &self.logger_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13142,21 +21167,13 @@ pub mod notification { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - if let Some(if_match) = &self.if_match { - req_builder = req_builder.header("If-Match", 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NotificationContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -13172,22 +21189,38 @@ pub mod notification { } } } -pub mod notification_recipient_user { +pub mod named_value { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_notification( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - notification_name: impl Into, subscription_id: impl Into, - ) -> list_by_notification::Builder { - list_by_notification::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - notification_name: notification_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, + named_value_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(), + named_value_id: named_value_id.into(), subscription_id: subscription_id.into(), } } @@ -13195,16 +21228,36 @@ pub mod notification_recipient_user { &self, resource_group_name: impl Into, service_name: impl Into, - notification_name: impl Into, - user_id: impl Into, + named_value_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(), - notification_name: notification_name.into(), - user_id: user_id.into(), + named_value_id: named_value_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + named_value_id: named_value_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } @@ -13212,38 +21265,152 @@ pub mod notification_recipient_user { &self, resource_group_name: impl Into, service_name: impl Into, - notification_name: impl Into, - user_id: impl Into, + named_value_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(), - notification_name: notification_name.into(), - user_id: user_id.into(), + named_value_id: named_value_id.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } - pub fn check_entity_exists( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, - notification_name: impl Into, - user_id: impl Into, + named_value_id: impl Into, subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - notification_name: notification_name.into(), - user_id: user_id.into(), + named_value_id: named_value_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_value( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_id: impl Into, + subscription_id: impl Into, + ) -> list_value::Builder { + list_value::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + named_value_id: named_value_id.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_notification { + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/namedValues", + 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", "2019-12-01"); + 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::NamedValueCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13272,13 +21439,20 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, + pub(crate) named_value_id: String, 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.ApiManagement/service/{}/notifications/{}/recipientUsers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_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); @@ -13297,7 +21471,7 @@ pub mod notification_recipient_user { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientUserCollection = + let rsp_value: models::NamedValueContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -13319,8 +21493,9 @@ pub mod notification_recipient_user { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::RecipientUserContract), - Ok200(models::RecipientUserContract), + Accepted202, + Created201(models::NamedValueContract), + Ok200(models::NamedValueContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13349,14 +21524,26 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) user_id: String, + pub(crate) named_value_id: String, + pub(crate) parameters: models::NamedValueCreateContract, 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/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_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); @@ -13367,21 +21554,26 @@ pub mod notification_recipient_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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::ACCEPTED => Ok(Response::Accepted202), http::StatusCode::CREATED => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientUserContract = + let rsp_value: models::NamedValueContract = 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::RecipientUserContract = + let rsp_value: models::NamedValueContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -13399,12 +21591,13 @@ pub mod notification_recipient_user { } } } - pub mod delete { + pub mod update { use super::models; #[derive(Debug)] pub enum Response { - Ok200, + Accepted202, NoContent204, + Ok200(models::NamedValueContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13433,17 +21626,25 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) user_id: String, + pub(crate) named_value_id: String, + pub(crate) parameters: models::NamedValueUpdateParameters, + 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/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13451,14 +21652,22 @@ pub mod notification_recipient_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NamedValueContract = + 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 = @@ -13473,12 +21682,15 @@ pub mod notification_recipient_user { } } } - pub mod check_entity_exists { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Error response #response_type")] - NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -13504,17 +21716,24 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) user_id: String, + pub(crate) named_value_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<(), Error>> { + 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/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13522,14 +21741,15 @@ pub mod notification_recipient_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); + 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::NO_CONTENT => Ok(()), - http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + 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 = @@ -13544,79 +21764,7 @@ pub mod notification_recipient_user { } } } -} -pub mod notification_recipient_email { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_notification( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - subscription_id: impl Into, - ) -> list_by_notification::Builder { - list_by_notification::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - notification_name: notification_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - email: 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(), - notification_name: notification_name.into(), - email: email.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - email: 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(), - notification_name: notification_name.into(), - email: email.into(), - subscription_id: subscription_id.into(), - } - } - pub fn check_entity_exists( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - email: impl Into, - subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - notification_name: notification_name.into(), - email: email.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_notification { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13645,16 +21793,23 @@ pub mod notification_recipient_email { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, + pub(crate) named_value_id: String, 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<(), Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13668,12 +21823,7 @@ pub mod notification_recipient_email { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientEmailCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -13688,13 +21838,8 @@ pub mod notification_recipient_email { } } } - pub mod create_or_update { + pub mod list_value { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::RecipientEmailContract), - Ok200(models::RecipientEmailContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13722,17 +21867,23 @@ pub mod notification_recipient_email { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) email: String, + pub(crate) named_value_id: String, 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.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}/listValue", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13741,22 +21892,17 @@ pub mod notification_recipient_email { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientEmailContract = - 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::RecipientEmailContract = + let rsp_value: models::PropertyValueContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -13772,13 +21918,42 @@ pub mod notification_recipient_email { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, +} +pub mod network_status { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> list_by_service::Builder { + list_by_service::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_by_location( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + location_name: impl Into, + ) -> list_by_location::Builder { + list_by_location::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + location_name: location_name.into(), + } } + } + pub mod list_by_service { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13804,19 +21979,25 @@ pub mod notification_recipient_email { #[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) notification_name: String, - pub(crate) email: String, - 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, Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/networkstatus", + 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13830,8 +22011,12 @@ pub mod notification_recipient_email { let rsp = 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::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::ErrorResponse = @@ -13846,12 +22031,10 @@ pub mod notification_recipient_email { } } } - pub mod check_entity_exists { + pub mod list_by_location { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Error response #response_type")] - NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -13875,19 +22058,25 @@ pub mod notification_recipient_email { #[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) notification_name: String, - pub(crate) email: String, - pub(crate) subscription_id: String, + pub(crate) location_name: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/locations/{}/networkstatus", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.location_name + ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13901,8 +22090,12 @@ pub mod notification_recipient_email { let 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(()), - http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkStatusContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -13918,7 +22111,7 @@ pub mod notification_recipient_email { } } } -pub mod open_id_connect_provider { +pub mod notification { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -13933,7 +22126,6 @@ pub mod open_id_connect_provider { resource_group_name: resource_group_name.into(), service_name: service_name.into(), subscription_id: subscription_id.into(), - filter: None, top: None, skip: None, } @@ -13942,14 +22134,14 @@ pub mod open_id_connect_provider { &self, resource_group_name: impl Into, service_name: impl Into, - opid: impl Into, + notification_name: 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(), - opid: opid.into(), + notification_name: notification_name.into(), subscription_id: subscription_id.into(), } } @@ -13957,86 +22149,18 @@ pub mod open_id_connect_provider { &self, resource_group_name: impl Into, service_name: impl Into, - opid: impl Into, - parameters: impl Into, + notification_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(), service_name: service_name.into(), - opid: opid.into(), - parameters: parameters.into(), + notification_name: notification_name.into(), subscription_id: subscription_id.into(), if_match: None, } } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - opid: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - opid: opid.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - opid: 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(), - opid: opid.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, - opid: 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(), - opid: opid.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_secrets( - &self, - resource_group_name: impl Into, - service_name: impl Into, - opid: impl Into, - subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - opid: opid.into(), - subscription_id: subscription_id.into(), - } - } } pub mod list_by_service { use super::models; @@ -14068,15 +22192,10 @@ pub mod open_id_connect_provider { 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 @@ -14085,12 +22204,10 @@ pub mod open_id_connect_provider { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/openidConnectProviders", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -14106,9 +22223,6 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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()); } @@ -14123,7 +22237,7 @@ pub mod open_id_connect_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OpenIdConnectProviderCollection = + let rsp_value: models::NotificationCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -14170,21 +22284,19 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, + pub(crate) notification_name: String, 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.ApiManagement/service/{}/openidConnectProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.opid + &self.notification_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -14204,7 +22316,7 @@ pub mod open_id_connect_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OpenidConnectProviderContract = + let rsp_value: models::NotificationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -14219,16 +22331,11 @@ pub mod open_id_connect_provider { } } }) - } - } - } - pub mod create_or_update { - use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::OpenidConnectProviderContract), - Ok200(models::OpenidConnectProviderContract), + } } + } + pub mod create_or_update { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -14256,8 +22363,7 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, - pub(crate) parameters: models::OpenidConnectProviderContract, + pub(crate) notification_name: String, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -14266,15 +22372,15 @@ pub mod open_id_connect_provider { self.if_match = Some(if_match.into()); self } - 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.ApiManagement/service/{}/openidConnectProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.opid + &self.notification_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -14286,27 +22392,20 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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); } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::OpenidConnectProviderContract = - 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::OpenidConnectProviderContract = + let rsp_value: models::NotificationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -14322,7 +22421,79 @@ pub mod open_id_connect_provider { } } } - pub mod update { +} +pub mod notification_recipient_user { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_notification( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + subscription_id: impl Into, + ) -> list_by_notification::Builder { + list_by_notification::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + user_id: 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(), + notification_name: notification_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + user_id: 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(), + notification_name: notification_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_notification { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14351,25 +22522,16 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, - pub(crate) parameters: models::OpenidConnectProviderUpdateContract, - pub(crate) if_match: String, + pub(crate) notification_name: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14377,15 +22539,18 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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.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::NO_CONTENT => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecipientUserCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -14400,12 +22565,12 @@ pub mod open_id_connect_provider { } } } - pub mod delete { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200, - NoContent204, + Created201(models::RecipientUserContract), + Ok200(models::RecipientUserContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14434,24 +22599,17 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, - pub(crate) if_match: String, + pub(crate) notification_name: String, + pub(crate) user_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/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14459,15 +22617,24 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecipientUserContract = + 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::RecipientUserContract = + 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 = @@ -14482,8 +22649,13 @@ pub mod open_id_connect_provider { } } } - pub mod get_entity_tag { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -14511,23 +22683,17 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, + pub(crate) notification_name: String, + pub(crate) user_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14541,7 +22707,8 @@ pub mod open_id_connect_provider { let rsp = 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(()), + 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 = @@ -14556,10 +22723,12 @@ pub mod open_id_connect_provider { } } } - pub mod list_secrets { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -14585,16 +22754,17 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, + pub(crate) notification_name: String, + pub(crate) user_id: String, 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<(), Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . opid) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14603,18 +22773,13 @@ pub mod open_id_connect_provider { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); 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::ClientSecretContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + http::StatusCode::NO_CONTENT => Ok(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -14630,91 +22795,78 @@ pub mod open_id_connect_provider { } } } -pub mod policy { +pub mod notification_recipient_email { use super::models; 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(), - } - } - pub fn get( + pub fn list_by_notification( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, + notification_name: impl Into, subscription_id: impl Into, - ) -> get::Builder { - get::Builder { + ) -> list_by_notification::Builder { + list_by_notification::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - policy_id: policy_id.into(), + notification_name: notification_name.into(), subscription_id: subscription_id.into(), - format: None, } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, - parameters: impl Into, + notification_name: impl Into, + email: 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(), - policy_id: policy_id.into(), - parameters: parameters.into(), + notification_name: notification_name.into(), + email: email.into(), subscription_id: subscription_id.into(), - if_match: None, } } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, - if_match: impl Into, + notification_name: impl Into, + email: 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(), - policy_id: policy_id.into(), - if_match: if_match.into(), + notification_name: notification_name.into(), + email: email.into(), subscription_id: subscription_id.into(), } } - pub fn get_entity_tag( + pub fn check_entity_exists( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, + notification_name: impl Into, + email: impl Into, subscription_id: impl Into, - ) -> get_entity_tag::Builder { - get_entity_tag::Builder { + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - policy_id: policy_id.into(), + notification_name: notification_name.into(), + email: email.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_service { + pub mod list_by_notification { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14743,18 +22895,13 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) notification_name: String, 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.ApiManagement/service/{}/policies", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::GET); @@ -14773,7 +22920,7 @@ pub mod policy { match 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 = + let rsp_value: models::RecipientEmailCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -14791,8 +22938,13 @@ pub mod policy { } } } - pub mod get { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::RecipientEmailContract), + Ok200(models::RecipientEmailContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -14820,28 +22972,17 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, + pub(crate) notification_name: String, + pub(crate) email: String, pub(crate) subscription_id: String, - pub(crate) format: Option, } impl Builder { - pub fn format(mut self, format: impl Into) -> Self { - self.format = Some(format.into()); - self - } - 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.ApiManagement/service/{}/policies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.policy_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14849,20 +22990,23 @@ pub mod policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - if let Some(format) = &self.format { - url.query_pairs_mut().append_pair("format", format); - } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::RecipientEmailContract = + 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::PolicyContract = + let rsp_value: models::RecipientEmailContract = 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)?; @@ -14878,12 +23022,12 @@ pub mod policy { } } } - pub mod create_or_update { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::PolicyContract), - Ok200(models::PolicyContract), + Ok200, + NoContent204, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14912,29 +23056,17 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, - pub(crate) parameters: models::PolicyContract, + pub(crate) notification_name: String, + pub(crate) email: String, 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/{}/policies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.policy_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; let mut url = 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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14942,28 +23074,85 @@ pub mod policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::PolicyContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Created201(rsp_value)) - } - http::StatusCode::OK => { + 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::PolicyContract = + let rsp_value: models::ErrorResponse = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) } + } + }) + } + } + } + pub mod check_entity_exists { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) notification_name: String, + pub(crate) email: 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/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let mut url = 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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -14978,13 +23167,129 @@ pub mod policy { } } } - pub mod delete { +} +pub mod open_id_connect_provider { + use super::models; + 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, + opid: 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(), + opid: opid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: 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(), + opid: opid.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + opid: opid.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: 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(), + opid: opid.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, + opid: 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(), + opid: opid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + opid: opid.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15012,24 +23317,38 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, - pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.policy_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15037,15 +23356,27 @@ pub mod policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - req_builder = req_builder.header("If-Match", &self.if_match); + 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 => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenIdConnectProviderCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -15060,7 +23391,7 @@ pub mod policy { } } } - pub mod get_entity_tag { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -15089,23 +23420,25 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, + pub(crate) opid: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.policy_id + &self.opid ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15119,7 +23452,12 @@ pub mod policy { let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenidConnectProviderContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -15134,28 +23472,13 @@ pub mod policy { } } } -} -pub mod policy_description { - use super::models; - 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(), - scope: None, - } - } - } - pub mod list_by_service { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::OpenidConnectProviderContract), + Ok200(models::OpenidConnectProviderContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15183,130 +23506,73 @@ pub mod policy_description { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) opid: String, + pub(crate) parameters: models::OpenidConnectProviderContract, pub(crate) subscription_id: String, - pub(crate) scope: Option, + pub(crate) if_match: Option, } impl Builder { - pub fn scope(mut self, scope: impl Into) -> Self { - self.scope = Some(scope.into()); + 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> { + 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/{}/policyDescriptions", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.opid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + 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", "2019-12-01"); - if let Some(scope) = &self.scope { - url.query_pairs_mut().append_pair("scope", scope); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PolicyDescriptionCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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 sign_in_settings { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - resource_group_name: impl Into, - service_name: 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(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - 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(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - parameters: parameters.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, - 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(), - subscription_id: subscription_id.into(), + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-12-01"); + 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::OpenidConnectProviderContract = + 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::OpenidConnectProviderContract = + 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 get { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -15335,21 +23601,25 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) opid: String, + pub(crate) parameters: models::OpenidConnectProviderUpdateContract, + pub(crate) if_match: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.opid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15357,18 +23627,15 @@ pub mod sign_in_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSigninSettings = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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::ErrorResponse = @@ -15383,8 +23650,13 @@ pub mod sign_in_settings { } } } - pub mod create_or_update { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15412,27 +23684,24 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSigninSettings, + pub(crate) opid: String, + pub(crate) if_match: String, 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> { + 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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.opid ); let mut url = 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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15440,22 +23709,15 @@ pub mod sign_in_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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.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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSigninSettings = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -15470,7 +23732,7 @@ pub mod sign_in_settings { } } } - pub mod update { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -15499,23 +23761,23 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSigninSettings, - pub(crate) if_match: String, + pub(crate) opid: 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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.opid ); let mut url = 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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15523,15 +23785,13 @@ pub mod sign_in_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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.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::NO_CONTENT => Ok(()), + 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 = @@ -15546,7 +23806,7 @@ pub mod sign_in_settings { } } } - pub mod get_entity_tag { + pub mod list_secrets { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -15575,21 +23835,16 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) opid: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/portalsettings/signin", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . opid) ; let mut url = 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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15598,12 +23853,18 @@ pub mod sign_in_settings { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClientSecretContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -15619,52 +23880,70 @@ pub mod sign_in_settings { } } } -pub mod sign_up_settings { +pub mod policy { use super::models; 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(), + } + } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, + policy_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(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), + format: None, } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + policy_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(), + policy_id: policy_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, } } - pub fn update( + pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + policy_id: impl Into, if_match: impl Into, subscription_id: impl Into, - ) -> update::Builder { - update::Builder { + ) -> delete::Builder { + delete::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - parameters: parameters.into(), + policy_id: policy_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -15673,16 +23952,95 @@ pub mod sign_up_settings { &self, resource_group_name: impl Into, service_name: impl Into, + policy_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(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), } } } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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, + } + impl Builder { + 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/{}/policies", + 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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match 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)?; + 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; #[derive(Debug, thiserror :: Error)] @@ -15712,17 +24070,24 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) policy_id: String, pub(crate) subscription_id: String, + pub(crate) format: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.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/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -15734,6 +24099,9 @@ pub mod sign_up_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -15742,7 +24110,7 @@ pub mod sign_up_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSignupSettings = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -15762,6 +24130,11 @@ pub mod sign_up_settings { } pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15789,7 +24162,8 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSignupSettings, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -15798,14 +24172,15 @@ pub mod sign_up_settings { self.if_match = Some(if_match.into()); self } - 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.ApiManagement/service/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -15827,11 +24202,17 @@ pub mod sign_up_settings { let 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::PolicyContract = + 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::PortalSignupSettings = + let rsp_value: models::PolicyContract = 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)?; @@ -15847,8 +24228,13 @@ pub mod sign_up_settings { } } } - pub mod update { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15876,23 +24262,24 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSignupSettings, + pub(crate) policy_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<(), Error>> { + 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/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15900,15 +24287,15 @@ pub mod sign_up_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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.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::NO_CONTENT => Ok(()), + 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 = @@ -15952,17 +24339,19 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) policy_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/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -15996,84 +24385,26 @@ pub mod sign_up_settings { } } } -pub mod delegation_settings { +pub mod policy_description { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn get( - &self, - resource_group_name: impl Into, - service_name: 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(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - 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(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - parameters: parameters.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, - 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(), - subscription_id: subscription_id.into(), - } - } - pub fn list_secrets( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { + ) -> 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(), + scope: None, } } } - pub mod get { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -16103,12 +24434,19 @@ pub mod delegation_settings { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) subscription_id: String, + pub(crate) scope: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn scope(mut self, scope: impl Into) -> Self { + self.scope = Some(scope.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/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policyDescriptions", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -16124,6 +24462,9 @@ pub mod delegation_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); + if let Some(scope) = &self.scope { + url.query_pairs_mut().append_pair("scope", scope); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -16132,7 +24473,7 @@ pub mod delegation_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalDelegationSettings = + let rsp_value: models::PolicyDescriptionCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -16150,7 +24491,72 @@ pub mod delegation_settings { } } } - pub mod create_or_update { +} +pub mod sign_in_settings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + service_name: 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(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + 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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.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, + 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(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -16179,19 +24585,13 @@ pub mod delegation_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalDelegationSettings, 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> { + 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/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -16199,7 +24599,7 @@ pub mod delegation_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16207,11 +24607,7 @@ pub mod delegation_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -16219,7 +24615,7 @@ pub mod delegation_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalDelegationSettings = + let rsp_value: models::PortalSigninSettings = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -16237,7 +24633,7 @@ pub mod delegation_settings { } } } - pub mod update { + pub mod create_or_update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -16266,15 +24662,19 @@ pub mod delegation_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalDelegationSettings, - pub(crate) if_match: String, + pub(crate) parameters: models::PortalSigninSettings, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -16282,7 +24682,7 @@ pub mod delegation_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16292,13 +24692,20 @@ pub mod delegation_settings { url.query_pairs_mut().append_pair("api-version", "2019-12-01"); 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.header("If-Match", &self.if_match); + 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::NO_CONTENT => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalSigninSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -16313,7 +24720,7 @@ pub mod delegation_settings { } } } - pub mod get_entity_tag { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -16342,13 +24749,15 @@ pub mod delegation_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) parameters: models::PortalSigninSettings, + pub(crate) if_match: 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/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -16356,7 +24765,7 @@ pub mod delegation_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16364,13 +24773,15 @@ pub mod delegation_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => Ok(()), + 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::ErrorResponse = @@ -16385,7 +24796,7 @@ pub mod delegation_settings { } } } - pub mod list_secrets { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -16417,14 +24828,18 @@ pub mod delegation_settings { 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<(), Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", + 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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16433,18 +24848,12 @@ pub mod delegation_settings { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); 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::PortalSettingValidationKeyContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -16460,40 +24869,20 @@ pub mod delegation_settings { } } } -pub mod product { +pub mod sign_up_settings { use super::models; 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, - expand_groups: None, - tags: None, - } - } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - product_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(), - product_id: product_id.into(), subscription_id: subscription_id.into(), } } @@ -16501,15 +24890,13 @@ pub mod product { &self, resource_group_name: impl Into, service_name: impl Into, - product_id: impl Into, - parameters: 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(), - product_id: product_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -16519,8 +24906,7 @@ pub mod product { &self, resource_group_name: impl Into, service_name: impl Into, - product_id: impl Into, - parameters: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -16528,64 +24914,190 @@ pub mod product { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - product_id: product_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_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(), - product_id: product_id.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - delete_subscriptions: None, - } - } pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, - product_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(), - product_id: product_id.into(), subscription_id: subscription_id.into(), } } - pub fn list_by_tags( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> list_by_tags::Builder { - list_by_tags::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, - include_not_tagged_products: None, + } + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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, + } + impl Builder { + 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/{}/portalsettings/signup", + 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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalSignupSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) parameters: models::PortalSignupSettings, + 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/{}/portalsettings/signup", + 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", "2019-12-01"); + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalSignupSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_service { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -16614,38 +25126,15 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) parameters: models::PortalSignupSettings, + pub(crate) if_match: String, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, - pub(crate) expand_groups: Option, - pub(crate) tags: 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 expand_groups(mut self, expand_groups: bool) -> Self { - self.expand_groups = Some(expand_groups); - self - } - pub fn tags(mut self, tags: impl Into) -> Self { - self.tags = Some(tags.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/products", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -16653,7 +25142,7 @@ pub mod product { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16661,33 +25150,15 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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()); - } - if let Some(expand_groups) = &self.expand_groups { - url.query_pairs_mut().append_pair("expandGroups", &expand_groups.to_string()); - } - if let Some(tags) = &self.tags { - url.query_pairs_mut().append_pair("tags", tags); - } - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProductCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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::ErrorResponse = @@ -16702,7 +25173,7 @@ pub mod product { } } } - pub mod get { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -16731,23 +25202,21 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16761,12 +25230,7 @@ pub mod product { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProductContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -16781,13 +25245,86 @@ pub mod product { } } } - pub mod create_or_update { - use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ProductContract), - Ok200(models::ProductContract), +} +pub mod delegation_settings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + service_name: 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(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + 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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.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, + 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(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } } + } + pub mod get { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -16815,29 +25352,21 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) parameters: models::ProductContract, 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> { + 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16845,27 +25374,17 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ProductContract = - 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::ProductContract = + let rsp_value: models::PortalDelegationSettings = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -16881,7 +25400,7 @@ pub mod product { } } } - pub mod update { + pub mod create_or_update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -16910,25 +25429,27 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) parameters: models::ProductUpdateParameters, - pub(crate) if_match: String, + pub(crate) parameters: models::PortalDelegationSettings, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16938,13 +25459,20 @@ pub mod product { url.query_pairs_mut().append_pair("api-version", "2019-12-01"); 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.header("If-Match", &self.if_match); + 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::NO_CONTENT => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalDelegationSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -16959,13 +25487,8 @@ pub mod product { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } + pub mod update { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -16993,29 +25516,23 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, + pub(crate) parameters: models::PortalDelegationSettings, pub(crate) if_match: String, pub(crate) subscription_id: String, - pub(crate) delete_subscriptions: Option, } impl Builder { - pub fn delete_subscriptions(mut self, delete_subscriptions: bool) -> Self { - self.delete_subscriptions = Some(delete_subscriptions); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17023,19 +25540,15 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); + 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.header("If-Match", &self.if_match); - if let Some(delete_subscriptions) = &self.delete_subscriptions { - url.query_pairs_mut() - .append_pair("deleteSubscriptions", &delete_subscriptions.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::NO_CONTENT => Ok(Response::NoContent204), + 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::ErrorResponse = @@ -17079,19 +25592,17 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &self.service_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -17124,7 +25635,7 @@ pub mod product { } } } - pub mod list_by_tags { + pub mod list_secrets { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17154,40 +25665,16 @@ pub mod product { 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, - pub(crate) include_not_tagged_products: 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 include_not_tagged_products(mut self, include_not_tagged_products: bool) -> Self { - self.include_not_tagged_products = Some(include_not_tagged_products); - self - } - 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.ApiManagement/service/{}/productsByTags", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation/listSecrets" , 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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17195,20 +25682,8 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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()); - } - if let Some(include_not_tagged_products) = &self.include_not_tagged_products { - url.query_pairs_mut() - .append_pair("includeNotTaggedProducts", &include_not_tagged_products.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)?; @@ -17216,7 +25691,7 @@ pub mod product { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagResourceCollection = + let rsp_value: models::PortalSettingValidationKeyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -17235,26 +25710,41 @@ pub mod product { } } } -pub mod product_api { +pub mod product { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_product( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - product_id: impl Into, subscription_id: impl Into, - ) -> list_by_product::Builder { - list_by_product::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - product_id: product_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, + expand_groups: None, + tags: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_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(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), } } pub fn create_or_update( @@ -17262,7 +25752,7 @@ pub mod product_api { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - api_id: impl Into, + parameters: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -17270,7 +25760,27 @@ pub mod product_api { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - api_id: api_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } @@ -17279,7 +25789,7 @@ pub mod product_api { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - api_id: impl Into, + if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { delete::Builder { @@ -17287,138 +25797,46 @@ pub mod product_api { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - api_id: api_id.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), + delete_subscriptions: None, } } - pub fn check_entity_exists( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - api_id: impl Into, subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - api_id: api_id.into(), subscription_id: subscription_id.into(), } } - } - pub mod list_by_product { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: 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/{}/products/{}/apis", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_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", "2019-12-01"); - 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::ApiCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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 list_by_tags( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_tags::Builder { + list_by_tags::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, + include_not_tagged_products: None, } } } - pub mod create_or_update { + pub mod list_by_service { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ApiContract), - Ok200(models::ApiContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -17446,25 +25864,46 @@ pub mod product_api { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) api_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) expand_groups: Option, + pub(crate) tags: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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 expand_groups(mut self, expand_groups: bool) -> Self { + self.expand_groups = Some(expand_groups); + self + } + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.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/{}/products/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.api_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17472,23 +25911,32 @@ pub mod product_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); + 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()); + } + if let Some(expand_groups) = &self.expand_groups { + url.query_pairs_mut().append_pair("expandGroups", &expand_groups.to_string()); + } + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ApiContract = - 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::ApiContract = + let rsp_value: models::ProductCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -17504,13 +25952,8 @@ pub mod product_api { } } } - pub mod delete { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -17539,24 +25982,22 @@ pub mod product_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) api_id: String, 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.ApiManagement/service/{}/products/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.api_id + &self.product_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17570,175 +26011,33 @@ pub mod product_api { let rsp = 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 => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ErrorResponse = + let rsp_value: models::ProductContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) + Ok(rsp_value) } - } - }) - } - } - } - pub mod check_entity_exists { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: String, - pub(crate) api_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/{}/products/{}/apis/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.api_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", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let 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::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 product_group { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - subscription_id: impl Into, - ) -> list_by_product::Builder { - list_by_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - group_id: 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(), - product_id: product_id.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - group_id: 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(), - product_id: product_id.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn check_entity_exists( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - group_id: impl Into, - subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) } } } - pub mod list_by_product { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ProductContract), + Ok200(models::ProductContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -17767,28 +26066,19 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, + pub(crate) parameters: models::ProductContract, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, + pub(crate) if_match: 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); + 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> { + 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/{}/products/{}/groups", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -17797,7 +26087,7 @@ pub mod product_group { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17805,26 +26095,27 @@ pub mod product_group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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()); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ProductContract = + 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::GroupCollection = + let rsp_value: models::ProductContract = 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)?; @@ -17840,13 +26131,8 @@ pub mod product_group { } } } - pub mod create_or_update { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::GroupContract), - Ok200(models::GroupContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -17875,24 +26161,24 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) group_id: String, + pub(crate) parameters: models::ProductUpdateParameters, + pub(crate) if_match: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.group_id + &self.product_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17900,24 +26186,15 @@ pub mod product_group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::GroupContract = - 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::GroupContract = - 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(()), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -17967,20 +26244,24 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) group_id: String, + pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) delete_subscriptions: Option, } impl Builder { + pub fn delete_subscriptions(mut self, delete_subscriptions: bool) -> Self { + self.delete_subscriptions = Some(delete_subscriptions); + 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/{}/products/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.group_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -17992,6 +26273,11 @@ pub mod product_group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); + req_builder = req_builder.header("If-Match", &self.if_match); + if let Some(delete_subscriptions) = &self.delete_subscriptions { + url.query_pairs_mut() + .append_pair("deleteSubscriptions", &delete_subscriptions.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)?; @@ -18014,7 +26300,7 @@ pub mod product_group { } } } - pub mod check_entity_exists { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18044,20 +26330,18 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) group_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/{}/products/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.group_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -18075,7 +26359,7 @@ pub mod product_group { let 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(()), + 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 = @@ -18090,31 +26374,7 @@ pub mod product_group { } } } -} -pub mod product_subscriptions { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - } - pub mod list { + pub mod list_by_tags { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18143,11 +26403,11 @@ pub mod product_subscriptions { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, + pub(crate) include_not_tagged_products: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -18162,15 +26422,18 @@ pub mod product_subscriptions { self.skip = Some(skip); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn include_not_tagged_products(mut self, include_not_tagged_products: bool) -> Self { + self.include_not_tagged_products = Some(include_not_tagged_products); + 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/{}/products/{}/subscriptions", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/productsByTags", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &self.service_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -18191,6 +26454,10 @@ pub mod product_subscriptions { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } + if let Some(include_not_tagged_products) = &self.include_not_tagged_products { + url.query_pairs_mut() + .append_pair("includeNotTaggedProducts", &include_not_tagged_products.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)?; @@ -18199,7 +26466,7 @@ pub mod product_subscriptions { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::SubscriptionCollection = + let rsp_value: models::TagResourceCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -18218,7 +26485,7 @@ pub mod product_subscriptions { } } } -pub mod product_policy { +pub mod product_api { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -18235,24 +26502,9 @@ pub mod product_policy { service_name: service_name.into(), product_id: product_id.into(), subscription_id: subscription_id.into(), - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - policy_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(), - product_id: product_id.into(), - policy_id: policy_id.into(), - subscription_id: subscription_id.into(), - format: None, + filter: None, + top: None, + skip: None, } } pub fn create_or_update( @@ -18260,8 +26512,7 @@ pub mod product_policy { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - policy_id: impl Into, - parameters: impl Into, + api_id: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -18269,10 +26520,8 @@ pub mod product_policy { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - policy_id: policy_id.into(), - parameters: parameters.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), - if_match: None, } } pub fn delete( @@ -18280,118 +26529,37 @@ pub mod product_policy { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - policy_id: impl Into, - if_match: impl Into, + api_id: 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(), - product_id: product_id.into(), - policy_id: policy_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, - product_id: impl Into, - policy_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(), - product_id: product_id.into(), - policy_id: policy_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_product { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: String, - pub(crate) subscription_id: String, + product_id: product_id.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } } - impl Builder { - 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/{}/products/{}/policies", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_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", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match 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)?; - 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 check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), } } } - pub mod get { + pub mod list_by_product { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18421,25 +26589,33 @@ pub mod product_policy { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) policy_id: String, pub(crate) subscription_id: String, - pub(crate) format: Option, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn format(mut self, format: impl Into) -> Self { - self.format = Some(format.into()); + 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> { + 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/{}/products/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.policy_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -18451,8 +26627,14 @@ pub mod product_policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - if let Some(format) = &self.format { - url.query_pairs_mut().append_pair("format", format); + 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()); @@ -18462,7 +26644,7 @@ pub mod product_policy { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PolicyContract = + let rsp_value: models::ApiCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -18484,8 +26666,8 @@ pub mod product_policy { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::PolicyContract), - Ok200(models::PolicyContract), + Created201(models::ApiContract), + Ok200(models::ApiContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18515,26 +26697,20 @@ pub mod product_policy { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) policy_id: String, - pub(crate) parameters: models::PolicyContract, + pub(crate) api_id: String, 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/{}/products/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.policy_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -18546,11 +26722,7 @@ pub mod product_policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - if let Some(if_match) = &self.if_match { - req_builder = req_builder.header("If-Match", if_match); - } - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -18558,13 +26730,13 @@ pub mod product_policy { 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::PolicyContract = + let rsp_value: models::ApiContract = 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::PolicyContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -18617,21 +26789,20 @@ pub mod product_policy { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) policy_id: String, - pub(crate) if_match: String, + pub(crate) api_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/{}/products/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.policy_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -18643,7 +26814,6 @@ pub mod product_policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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)?; @@ -18666,7 +26836,7 @@ pub mod product_policy { } } } - pub mod get_entity_tag { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18695,210 +26865,90 @@ pub mod product_policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) policy_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/{}/products/{}/policies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.policy_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", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = 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 tag { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - subscription_id: impl Into, - ) -> list_by_product::Builder { - list_by_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - pub fn get_by_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - tag_id: impl Into, - subscription_id: impl Into, - ) -> get_by_product::Builder { - get_by_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn assign_to_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - tag_id: impl Into, - subscription_id: impl Into, - ) -> assign_to_product::Builder { - assign_to_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn detach_from_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - tag_id: impl Into, - subscription_id: impl Into, - ) -> detach_from_product::Builder { - detach_from_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), + pub(crate) product_id: String, + pub(crate) api_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/{}/products/{}/apis/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.api_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", "2019-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::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 get_entity_state_by_product( + } +} +pub mod product_group { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_product( &self, resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - tag_id: impl Into, subscription_id: impl Into, - ) -> get_entity_state_by_product::Builder { - get_entity_state_by_product::Builder { + ) -> list_by_product::Builder { + list_by_product::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), - } - } - 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, - scope: None, - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - tag_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(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - tag_id: impl Into, - parameters: impl Into, + product_id: impl Into, + group_id: 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(), - tag_id: tag_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - tag_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - tag_id: tag_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), + product_id: product_id.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -18906,31 +26956,33 @@ pub mod tag { &self, resource_group_name: impl Into, service_name: impl Into, - tag_id: impl Into, - if_match: impl Into, + product_id: impl Into, + group_id: 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(), - tag_id: tag_id.into(), - if_match: if_match.into(), + product_id: product_id.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } - pub fn get_entity_state( + pub fn check_entity_exists( &self, resource_group_name: impl Into, service_name: impl Into, - tag_id: impl Into, + product_id: impl Into, + group_id: impl Into, subscription_id: impl Into, - ) -> get_entity_state::Builder { - get_entity_state::Builder { + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - tag_id: tag_id.into(), + product_id: product_id.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -18983,10 +27035,10 @@ pub mod tag { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/products/{}/tags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -19020,88 +27072,7 @@ pub mod tag { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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_product { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: String, - pub(crate) tag_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/{}/products/{}/tags/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.tag_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", "2019-12-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagContract = + let rsp_value: models::GroupCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -19119,12 +27090,12 @@ pub mod tag { } } } - pub mod assign_to_product { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::TagContract), - Ok200(models::TagContract), + Created201(models::GroupContract), + Ok200(models::GroupContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -19154,20 +27125,20 @@ pub mod tag { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) tag_id: String, + pub(crate) group_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/{}/products/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.tag_id + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -19187,13 +27158,13 @@ pub mod tag { 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::TagContract = + let rsp_value: models::GroupContract = 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::TagContract = + let rsp_value: models::GroupContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -19211,7 +27182,7 @@ pub mod tag { } } } - pub mod detach_from_product { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { @@ -19246,20 +27217,20 @@ pub mod tag { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) tag_id: String, + pub(crate) group_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/{}/products/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.tag_id + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -19293,7 +27264,7 @@ pub mod tag { } } } - pub mod get_entity_state_by_product { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -19323,20 +27294,20 @@ pub mod tag { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) tag_id: String, + pub(crate) group_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/{}/products/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.tag_id + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -19354,7 +27325,7 @@ pub mod tag { let rsp = 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(()), + 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::ErrorResponse = @@ -19369,7 +27340,31 @@ pub mod tag { } } } - pub mod list_by_service { +} +pub mod product_subscriptions { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -19398,11 +27393,11 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) product_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, - pub(crate) scope: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -19417,18 +27412,15 @@ pub mod tag { self.skip = Some(skip); self } - pub fn scope(mut self, scope: impl Into) -> Self { - self.scope = Some(scope.into()); - self - } - 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.ApiManagement/service/{}/tags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/subscriptions", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -19449,9 +27441,6 @@ pub mod tag { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } - if let Some(scope) = &self.scope { - url.query_pairs_mut().append_pair("scope", scope); - } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -19460,7 +27449,7 @@ pub mod tag { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagCollection = + let rsp_value: models::SubscriptionCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -19478,7 +27467,102 @@ pub mod tag { } } } - pub mod get { +} +pub mod product_policy { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list_by_product::Builder { + list_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + format: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_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, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_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, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_product { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -19507,19 +27591,19 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, + pub(crate) product_id: String, 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.ApiManagement/service/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -19539,7 +27623,7 @@ pub mod tag { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagContract = + let rsp_value: models::PolicyCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -19557,13 +27641,8 @@ pub mod tag { } } } - pub mod create_or_update { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::TagContract), - Ok200(models::TagContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -19591,29 +27670,30 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, - pub(crate) parameters: models::TagCreateUpdateParameters, + pub(crate) product_id: String, + pub(crate) policy_id: String, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) format: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.into()); self } - 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.ApiManagement/service/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -19621,27 +27701,20 @@ pub mod tag { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); - 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); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::TagContract = - 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::TagContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -19657,8 +27730,13 @@ pub mod tag { } } } - pub mod update { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -19686,25 +27764,31 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, - pub(crate) parameters: models::TagCreateUpdateParameters, - pub(crate) if_match: String, + pub(crate) product_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -19712,15 +27796,28 @@ pub mod tag { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } 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.header("If-Match", &self.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::NO_CONTENT => Ok(()), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + 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::PolicyContract = + 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 = @@ -19769,7 +27866,8 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, + pub(crate) product_id: String, + pub(crate) policy_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -19777,12 +27875,13 @@ pub mod tag { 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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -19817,7 +27916,7 @@ pub mod tag { } } } - pub mod get_entity_state { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -19846,19 +27945,21 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, + pub(crate) product_id: String, + pub(crate) policy_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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); diff --git a/services/mgmt/apimanagement/src/package_2020_12/operations.rs b/services/mgmt/apimanagement/src/package_2020_12/operations.rs index 592d3e9257..4c92833cef 100644 --- a/services/mgmt/apimanagement/src/package_2020_12/operations.rs +++ b/services/mgmt/apimanagement/src/package_2020_12/operations.rs @@ -77,9 +77,21 @@ impl Client { pub fn api(&self) -> api::Client { api::Client(self.clone()) } + pub fn api_diagnostic(&self) -> api_diagnostic::Client { + api_diagnostic::Client(self.clone()) + } pub fn api_export(&self) -> api_export::Client { api_export::Client(self.clone()) } + pub fn api_issue(&self) -> api_issue::Client { + api_issue::Client(self.clone()) + } + pub fn api_issue_attachment(&self) -> api_issue_attachment::Client { + api_issue_attachment::Client(self.clone()) + } + pub fn api_issue_comment(&self) -> api_issue_comment::Client { + api_issue_comment::Client(self.clone()) + } pub fn api_management_operations(&self) -> api_management_operations::Client { api_management_operations::Client(self.clone()) } @@ -92,6 +104,30 @@ impl Client { pub fn api_management_skus(&self) -> api_management_skus::Client { api_management_skus::Client(self.clone()) } + pub fn api_operation(&self) -> api_operation::Client { + api_operation::Client(self.clone()) + } + pub fn api_operation_policy(&self) -> api_operation_policy::Client { + api_operation_policy::Client(self.clone()) + } + pub fn api_policy(&self) -> api_policy::Client { + api_policy::Client(self.clone()) + } + pub fn api_product(&self) -> api_product::Client { + api_product::Client(self.clone()) + } + pub fn api_release(&self) -> api_release::Client { + api_release::Client(self.clone()) + } + pub fn api_revision(&self) -> api_revision::Client { + api_revision::Client(self.clone()) + } + pub fn api_schema(&self) -> api_schema::Client { + api_schema::Client(self.clone()) + } + pub fn api_tag_description(&self) -> api_tag_description::Client { + api_tag_description::Client(self.clone()) + } pub fn api_version_set(&self) -> api_version_set::Client { api_version_set::Client(self.clone()) } @@ -170,6 +206,9 @@ impl Client { pub fn open_id_connect_provider(&self) -> open_id_connect_provider::Client { open_id_connect_provider::Client(self.clone()) } + pub fn operation(&self) -> operation::Client { + operation::Client(self.clone()) + } pub fn policy(&self) -> policy::Client { policy::Client(self.clone()) } @@ -259,6 +298,152 @@ pub enum Error { #[error(transparent)] ApiExport_Get(#[from] api_export::get::Error), #[error(transparent)] + Api_ListByService(#[from] api::list_by_service::Error), + #[error(transparent)] + Api_Get(#[from] api::get::Error), + #[error(transparent)] + Api_CreateOrUpdate(#[from] api::create_or_update::Error), + #[error(transparent)] + Api_Update(#[from] api::update::Error), + #[error(transparent)] + Api_Delete(#[from] api::delete::Error), + #[error(transparent)] + Api_GetEntityTag(#[from] api::get_entity_tag::Error), + #[error(transparent)] + ApiRevision_ListByService(#[from] api_revision::list_by_service::Error), + #[error(transparent)] + ApiRelease_ListByService(#[from] api_release::list_by_service::Error), + #[error(transparent)] + ApiRelease_Get(#[from] api_release::get::Error), + #[error(transparent)] + ApiRelease_CreateOrUpdate(#[from] api_release::create_or_update::Error), + #[error(transparent)] + ApiRelease_Update(#[from] api_release::update::Error), + #[error(transparent)] + ApiRelease_Delete(#[from] api_release::delete::Error), + #[error(transparent)] + ApiRelease_GetEntityTag(#[from] api_release::get_entity_tag::Error), + #[error(transparent)] + ApiOperation_ListByApi(#[from] api_operation::list_by_api::Error), + #[error(transparent)] + ApiOperation_Get(#[from] api_operation::get::Error), + #[error(transparent)] + ApiOperation_CreateOrUpdate(#[from] api_operation::create_or_update::Error), + #[error(transparent)] + ApiOperation_Update(#[from] api_operation::update::Error), + #[error(transparent)] + ApiOperation_Delete(#[from] api_operation::delete::Error), + #[error(transparent)] + ApiOperation_GetEntityTag(#[from] api_operation::get_entity_tag::Error), + #[error(transparent)] + ApiOperationPolicy_ListByOperation(#[from] api_operation_policy::list_by_operation::Error), + #[error(transparent)] + ApiOperationPolicy_Get(#[from] api_operation_policy::get::Error), + #[error(transparent)] + ApiOperationPolicy_CreateOrUpdate(#[from] api_operation_policy::create_or_update::Error), + #[error(transparent)] + ApiOperationPolicy_Delete(#[from] api_operation_policy::delete::Error), + #[error(transparent)] + ApiOperationPolicy_GetEntityTag(#[from] api_operation_policy::get_entity_tag::Error), + #[error(transparent)] + Tag_ListByOperation(#[from] tag::list_by_operation::Error), + #[error(transparent)] + Tag_GetByOperation(#[from] tag::get_by_operation::Error), + #[error(transparent)] + Tag_AssignToOperation(#[from] tag::assign_to_operation::Error), + #[error(transparent)] + Tag_DetachFromOperation(#[from] tag::detach_from_operation::Error), + #[error(transparent)] + Tag_GetEntityStateByOperation(#[from] tag::get_entity_state_by_operation::Error), + #[error(transparent)] + ApiProduct_ListByApis(#[from] api_product::list_by_apis::Error), + #[error(transparent)] + ApiPolicy_ListByApi(#[from] api_policy::list_by_api::Error), + #[error(transparent)] + ApiPolicy_Get(#[from] api_policy::get::Error), + #[error(transparent)] + ApiPolicy_CreateOrUpdate(#[from] api_policy::create_or_update::Error), + #[error(transparent)] + ApiPolicy_Delete(#[from] api_policy::delete::Error), + #[error(transparent)] + ApiPolicy_GetEntityTag(#[from] api_policy::get_entity_tag::Error), + #[error(transparent)] + ApiSchema_ListByApi(#[from] api_schema::list_by_api::Error), + #[error(transparent)] + ApiSchema_Get(#[from] api_schema::get::Error), + #[error(transparent)] + ApiSchema_CreateOrUpdate(#[from] api_schema::create_or_update::Error), + #[error(transparent)] + ApiSchema_Delete(#[from] api_schema::delete::Error), + #[error(transparent)] + ApiSchema_GetEntityTag(#[from] api_schema::get_entity_tag::Error), + #[error(transparent)] + ApiDiagnostic_ListByService(#[from] api_diagnostic::list_by_service::Error), + #[error(transparent)] + ApiDiagnostic_Get(#[from] api_diagnostic::get::Error), + #[error(transparent)] + ApiDiagnostic_CreateOrUpdate(#[from] api_diagnostic::create_or_update::Error), + #[error(transparent)] + ApiDiagnostic_Update(#[from] api_diagnostic::update::Error), + #[error(transparent)] + ApiDiagnostic_Delete(#[from] api_diagnostic::delete::Error), + #[error(transparent)] + ApiDiagnostic_GetEntityTag(#[from] api_diagnostic::get_entity_tag::Error), + #[error(transparent)] + ApiIssue_ListByService(#[from] api_issue::list_by_service::Error), + #[error(transparent)] + ApiIssue_Get(#[from] api_issue::get::Error), + #[error(transparent)] + ApiIssue_CreateOrUpdate(#[from] api_issue::create_or_update::Error), + #[error(transparent)] + ApiIssue_Update(#[from] api_issue::update::Error), + #[error(transparent)] + ApiIssue_Delete(#[from] api_issue::delete::Error), + #[error(transparent)] + ApiIssue_GetEntityTag(#[from] api_issue::get_entity_tag::Error), + #[error(transparent)] + ApiIssueComment_ListByService(#[from] api_issue_comment::list_by_service::Error), + #[error(transparent)] + ApiIssueComment_Get(#[from] api_issue_comment::get::Error), + #[error(transparent)] + ApiIssueComment_CreateOrUpdate(#[from] api_issue_comment::create_or_update::Error), + #[error(transparent)] + ApiIssueComment_Delete(#[from] api_issue_comment::delete::Error), + #[error(transparent)] + ApiIssueComment_GetEntityTag(#[from] api_issue_comment::get_entity_tag::Error), + #[error(transparent)] + ApiIssueAttachment_ListByService(#[from] api_issue_attachment::list_by_service::Error), + #[error(transparent)] + ApiIssueAttachment_Get(#[from] api_issue_attachment::get::Error), + #[error(transparent)] + ApiIssueAttachment_CreateOrUpdate(#[from] api_issue_attachment::create_or_update::Error), + #[error(transparent)] + ApiIssueAttachment_Delete(#[from] api_issue_attachment::delete::Error), + #[error(transparent)] + ApiIssueAttachment_GetEntityTag(#[from] api_issue_attachment::get_entity_tag::Error), + #[error(transparent)] + ApiTagDescription_ListByService(#[from] api_tag_description::list_by_service::Error), + #[error(transparent)] + ApiTagDescription_Get(#[from] api_tag_description::get::Error), + #[error(transparent)] + ApiTagDescription_CreateOrUpdate(#[from] api_tag_description::create_or_update::Error), + #[error(transparent)] + ApiTagDescription_Delete(#[from] api_tag_description::delete::Error), + #[error(transparent)] + ApiTagDescription_GetEntityTag(#[from] api_tag_description::get_entity_tag::Error), + #[error(transparent)] + Tag_ListByApi(#[from] tag::list_by_api::Error), + #[error(transparent)] + Tag_GetByApi(#[from] tag::get_by_api::Error), + #[error(transparent)] + Tag_AssignToApi(#[from] tag::assign_to_api::Error), + #[error(transparent)] + Tag_DetachFromApi(#[from] tag::detach_from_api::Error), + #[error(transparent)] + Tag_GetEntityStateByApi(#[from] tag::get_entity_state_by_api::Error), + #[error(transparent)] + Operation_ListByTags(#[from] operation::list_by_tags::Error), + #[error(transparent)] Api_ListByTags(#[from] api::list_by_tags::Error), #[error(transparent)] ApiVersionSet_ListByService(#[from] api_version_set::list_by_service::Error), @@ -887,6 +1072,109 @@ pub mod api { use super::models; 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, + tags: None, + expand_api_version_set: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + delete_revisions: None, + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } pub fn list_by_tags( &self, resource_group_name: impl Into, @@ -905,7 +1193,7 @@ pub mod api { } } } - pub mod list_by_tags { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -938,7 +1226,8 @@ pub mod api { pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, - pub(crate) include_not_tagged_apis: Option, + pub(crate) tags: Option, + pub(crate) expand_api_version_set: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -953,14 +1242,18 @@ pub mod api { self.skip = Some(skip); self } - pub fn include_not_tagged_apis(mut self, include_not_tagged_apis: bool) -> Self { - self.include_not_tagged_apis = Some(include_not_tagged_apis); + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.into()); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn expand_api_version_set(mut self, expand_api_version_set: bool) -> Self { + self.expand_api_version_set = Some(expand_api_version_set); + 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/{}/apisByTags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -985,9 +1278,12 @@ pub mod api { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } - if let Some(include_not_tagged_apis) = &self.include_not_tagged_apis { + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } + if let Some(expand_api_version_set) = &self.expand_api_version_set { url.query_pairs_mut() - .append_pair("includeNotTaggedApis", &include_not_tagged_apis.to_string()); + .append_pair("expandApiVersionSet", &expand_api_version_set.to_string()); } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); @@ -997,7 +1293,7 @@ pub mod api { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagResourceCollection = + let rsp_value: models::ApiCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1015,255 +1311,48 @@ pub mod api { } } } -} -pub mod api_version_set { - use super::models; - 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, - version_set_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(), - version_set_id: version_set_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - version_set_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(), - version_set_id: version_set_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - version_set_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - version_set_id: version_set_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - version_set_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(), - version_set_id: version_set_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, - version_set_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(), - version_set_id: version_set_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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/{}/apiVersionSets", - 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", "2020-12-01"); - 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::ApiVersionSetCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_id: String, + pub(crate) api_id: String, 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.ApiManagement/service/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1283,7 +1372,7 @@ pub mod api_version_set { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiVersionSetContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1305,8 +1394,9 @@ pub mod api_version_set { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::ApiVersionSetContract), - Ok200(models::ApiVersionSetContract), + Created201(models::ApiContract), + Accepted202, + Ok200(models::ApiContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1335,8 +1425,8 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, - pub(crate) parameters: models::ApiVersionSetContract, + pub(crate) api_id: String, + pub(crate) parameters: models::ApiCreateOrUpdateParameter, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -1348,12 +1438,12 @@ pub mod api_version_set { 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/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1377,13 +1467,14 @@ pub mod api_version_set { 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::ApiVersionSetContract = + let rsp_value: models::ApiContract = 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), http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiVersionSetContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -1430,21 +1521,21 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, - pub(crate) parameters: models::ApiVersionSetUpdateParameters, + pub(crate) api_id: String, + pub(crate) parameters: models::ApiUpdateContract, pub(crate) if_match: String, 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.ApiManagement/service/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1466,7 +1557,7 @@ pub mod api_version_set { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiVersionSetContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1518,20 +1609,25 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, + pub(crate) api_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) delete_revisions: Option, } impl Builder { + pub fn delete_revisions(mut self, delete_revisions: bool) -> Self { + self.delete_revisions = Some(delete_revisions); + 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/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1543,6 +1639,9 @@ pub mod api_version_set { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + if let Some(delete_revisions) = &self.delete_revisions { + url.query_pairs_mut().append_pair("deleteRevisions", &delete_revisions.to_string()); + } 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()); @@ -1595,19 +1694,19 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, + pub(crate) api_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/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1640,128 +1739,7 @@ pub mod api_version_set { } } } -} -pub mod authorization_server { - use super::models; - 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, - authsid: 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(), - authsid: authsid.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: 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(), - authsid: authsid.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - authsid: authsid.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: 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(), - authsid: authsid.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, - authsid: 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(), - authsid: authsid.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_secrets( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: impl Into, - subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - authsid: authsid.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod list_by_tags { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1794,6 +1772,7 @@ pub mod authorization_server { pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, + pub(crate) include_not_tagged_apis: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -1808,12 +1787,14 @@ pub mod authorization_server { self.skip = Some(skip); self } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn include_not_tagged_apis(mut self, include_not_tagged_apis: bool) -> Self { + self.include_not_tagged_apis = Some(include_not_tagged_apis); + 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/{}/authorizationServers", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apisByTags", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -1838,6 +1819,10 @@ pub mod authorization_server { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } + if let Some(include_not_tagged_apis) = &self.include_not_tagged_apis { + url.query_pairs_mut() + .append_pair("includeNotTaggedApis", &include_not_tagged_apis.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)?; @@ -1846,7 +1831,7 @@ pub mod authorization_server { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerCollection = + let rsp_value: models::TagResourceCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1864,7 +1849,31 @@ pub mod authorization_server { } } } - pub mod get { +} +pub mod api_revision { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1893,21 +1902,34 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, + pub(crate) api_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/revisions", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1919,6 +1941,15 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + 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)?; @@ -1927,7 +1958,7 @@ pub mod authorization_server { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerContract = + let rsp_value: models::ApiRevisionCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1945,63 +1976,185 @@ pub mod authorization_server { } } } - pub mod create_or_update { - use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::AuthorizationServerContract), - Ok200(models::AuthorizationServerContract), +} +pub mod api_release { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } } - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_id.into(), + subscription_id: subscription_id.into(), + } } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + release_id: release_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_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, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: String, - pub(crate) parameters: models::AuthorizationServerContract, + pub(crate) api_id: String, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + 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> { + 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2009,27 +2162,26 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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); + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerContract = - 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::AuthorizationServerContract = + let rsp_value: models::ApiReleaseCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -2045,7 +2197,7 @@ pub mod authorization_server { } } } - pub mod update { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2074,27 +2226,25 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, - pub(crate) parameters: models::AuthorizationServerUpdateContract, - pub(crate) if_match: String, + pub(crate) api_id: String, + pub(crate) release_id: String, 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.ApiManagement/service/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2102,9 +2252,7 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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.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)?; @@ -2112,7 +2260,7 @@ pub mod authorization_server { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerContract = + let rsp_value: models::ApiReleaseContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2130,12 +2278,12 @@ pub mod authorization_server { } } } - pub mod delete { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200, - NoContent204, + Created201(models::ApiReleaseContract), + Ok200(models::ApiReleaseContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2164,24 +2312,31 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, - pub(crate) if_match: String, + pub(crate) api_id: String, + pub(crate) release_id: String, + pub(crate) parameters: models::ApiReleaseContract, 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2189,15 +2344,28 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - req_builder = req_builder.header("If-Match", &self.if_match); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiReleaseContract = + 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::ApiReleaseContract = + 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 = @@ -2212,7 +2380,7 @@ pub mod authorization_server { } } } - pub mod get_entity_tag { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2241,23 +2409,27 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, + pub(crate) api_id: String, + pub(crate) release_id: String, + pub(crate) parameters: models::ApiReleaseContract, + pub(crate) if_match: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2265,13 +2437,20 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiReleaseContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -2286,8 +2465,13 @@ pub mod authorization_server { } } } - pub mod list_secrets { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -2315,18 +2499,26 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, + pub(crate) api_id: String, + pub(crate) release_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> { + 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/{}/authorizationServers/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . authsid) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2334,19 +2526,15 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + req_builder = req_builder.header("If-Match", &self.if_match); 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::AuthorizationServerSecretsContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -2361,39 +2549,120 @@ pub mod authorization_server { } } } -} -pub mod backend { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_service( - &self, + pub mod get_entity_tag { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) release_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/{}/apis/{}/releases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.release_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_operation { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, resource_group_name: impl Into, service_name: impl Into, + api_id: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> list_by_api::Builder { + list_by_api::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, + tags: None, } } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, + api_id: impl Into, + operation_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(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), } } @@ -2401,15 +2670,17 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_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(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -2419,8 +2690,9 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -2428,7 +2700,8 @@ pub mod backend { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), @@ -2438,7 +2711,8 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, + api_id: impl Into, + operation_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -2446,7 +2720,8 @@ pub mod backend { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -2455,35 +2730,21 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, + api_id: impl Into, + operation_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(), - backend_id: backend_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn reconnect( - &self, - resource_group_name: impl Into, - service_name: impl Into, - backend_id: impl Into, - subscription_id: impl Into, - ) -> reconnect::Builder { - reconnect::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), - parameters: None, } } } - pub mod list_by_service { + pub mod list_by_api { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2512,10 +2773,12 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) api_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, + pub(crate) tags: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -2530,14 +2793,19 @@ pub mod backend { self.skip = Some(skip); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.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/{}/backends", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2558,6 +2826,9 @@ pub mod backend { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -2566,7 +2837,7 @@ pub mod backend { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackendCollection = + let rsp_value: models::OperationCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2613,19 +2884,21 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, 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.ApiManagement/service/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2645,7 +2918,7 @@ pub mod backend { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackendContract = + let rsp_value: models::OperationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2667,8 +2940,8 @@ pub mod backend { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::BackendContract), - Ok200(models::BackendContract), + Created201(models::OperationContract), + Ok200(models::OperationContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2697,8 +2970,9 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, - pub(crate) parameters: models::BackendContract, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) parameters: models::OperationContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -2710,12 +2984,13 @@ pub mod backend { 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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2739,13 +3014,13 @@ pub mod backend { 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::BackendContract = + let rsp_value: models::OperationContract = 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::BackendContract = + let rsp_value: models::OperationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -2792,21 +3067,23 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, - pub(crate) parameters: models::BackendUpdateParameters, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) parameters: models::OperationUpdateContract, pub(crate) if_match: String, 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.ApiManagement/service/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2828,7 +3105,7 @@ pub mod backend { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackendContract = + let rsp_value: models::OperationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2880,7 +3157,8 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -2888,12 +3166,13 @@ pub mod backend { 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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2957,19 +3236,21 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, + pub(crate) api_id: String, + pub(crate) operation_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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -3002,167 +3283,77 @@ pub mod backend { } } } - pub mod reconnect { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) backend_id: 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<(), Error>> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}/reconnect", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.backend_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", "2020-12-01"); - 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::ACCEPTED => 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 cache { +pub mod api_operation_policy { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_service( + pub fn list_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> list_by_operation::Builder { + list_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), - top: None, - skip: None, } } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_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(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), + format: None, } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_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(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, } } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - cache_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - cache_id: cache_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -3170,7 +3361,9 @@ pub mod cache { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -3179,19 +3372,23 @@ pub mod cache { &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_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(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_service { + pub mod list_by_operation { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3220,27 +3417,21 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, pub(crate) subscription_id: String, - pub(crate) top: Option, - pub(crate) skip: Option, } impl Builder { - 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> { + 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/{}/caches", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -3252,12 +3443,6 @@ pub mod cache { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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)?; @@ -3266,7 +3451,7 @@ pub mod cache { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CacheCollection = + let rsp_value: models::PolicyCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -3313,20 +3498,20 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_id: String, pub(crate) subscription_id: String, + pub(crate) format: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3337,6 +3522,9 @@ pub mod cache { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -3345,7 +3533,7 @@ pub mod cache { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CacheContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -3367,8 +3555,8 @@ pub mod cache { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::CacheContract), - Ok200(models::CacheContract), + Created201(models::PolicyContract), + Ok200(models::PolicyContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3397,8 +3585,10 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, - pub(crate) parameters: models::CacheContract, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -3409,14 +3599,7 @@ pub mod cache { } 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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3439,13 +3622,13 @@ pub mod cache { 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::CacheContract = + let rsp_value: models::PolicyContract = 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::CacheContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -3463,89 +3646,6 @@ pub mod cache { } } } - pub mod update { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) cache_id: String, - pub(crate) parameters: models::CacheUpdateParameters, - 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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_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", "2020-12-01"); - 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.header("If-Match", &self.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::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CacheContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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; #[derive(Debug)] @@ -3580,21 +3680,16 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3657,20 +3752,15 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3703,110 +3793,8351 @@ pub mod cache { } } } -pub mod certificate { +pub mod tag { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_service( + pub fn list_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> list_by_operation::Builder { + list_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, - is_key_vault_refresh_failed: None, } } - pub fn get( + pub fn get_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> get::Builder { - get::Builder { + ) -> get_by_operation::Builder { + get_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), } } - pub fn create_or_update( + pub fn assign_to_operation( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> create_or_update::Builder { - create_or_update::Builder { + ) -> assign_to_operation::Builder { + assign_to_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), - parameters: parameters.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), - if_match: None, } } - pub fn delete( + pub fn detach_from_operation( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, - if_match: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> delete::Builder { - delete::Builder { + ) -> detach_from_operation::Builder { + detach_from_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), - if_match: if_match.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), } } - pub fn get_entity_tag( + pub fn get_entity_state_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> get_entity_tag::Builder { - get_entity_tag::Builder { + ) -> get_entity_state_by_operation::Builder { + get_entity_state_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), } } - pub fn refresh_secret( + pub fn list_by_api( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, + api_id: impl Into, subscription_id: impl Into, - ) -> refresh_secret::Builder { - refresh_secret::Builder { + ) -> list_by_api::Builder { + list_by_api::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_by_api::Builder { + get_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn assign_to_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> assign_to_api::Builder { + assign_to_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn detach_from_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> detach_from_api::Builder { + detach_from_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state_by_api::Builder { + get_entity_state_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list_by_product::Builder { + list_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_by_product::Builder { + get_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn assign_to_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> assign_to_product::Builder { + assign_to_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn detach_from_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> detach_from_product::Builder { + detach_from_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state_by_product::Builder { + get_entity_state_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + 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, + scope: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_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(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_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(), + tag_id: tag_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + tag_id: tag_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_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(), + tag_id: tag_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state::Builder { + get_entity_state::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: 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/{}/apis/{}/operations/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2020-12-01"); + 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::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 assign_to_operation { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TagContract = + 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::TagContract = + 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 detach_from_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_state_by_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2020-12-01"); + 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::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 assign_to_api { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TagContract = + 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::TagContract = + 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 detach_from_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_state_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_by_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: 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/{}/products/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_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", "2020-12-01"); + 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::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 assign_to_product { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TagContract = + 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::TagContract = + 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 detach_from_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_state_by_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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, + pub(crate) scope: 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 scope(mut self, scope: impl Into) -> Self { + self.scope = Some(scope.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/{}/tags", + 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", "2020-12-01"); + 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()); + } + if let Some(scope) = &self.scope { + url.query_pairs_mut().append_pair("scope", scope); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_id: String, + pub(crate) parameters: models::TagCreateUpdateParameters, + 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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2020-12-01"); + 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::TagContract = + 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::TagContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_id: String, + pub(crate) parameters: models::TagCreateUpdateParameters, + 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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2020-12-01"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2020-12-01"); + 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_state { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_product { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_apis( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_apis::Builder { + list_by_apis::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list_by_apis { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/products", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2020-12-01"); + 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::ProductCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 api_policy { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + format: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_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, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_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, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_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/{}/apis/{}/policies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match 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)?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_id: String, + pub(crate) subscription_id: String, + pub(crate) format: Option, + } + impl Builder { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2020-12-01"); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, + 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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2020-12-01"); + 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::PolicyContract = + 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::PolicyContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2020-12-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_schema { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.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, + api_id: 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(), + api_id: api_id.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, + api_id: 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(), + api_id: api_id.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, + api_id: 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(), + api_id: api_id.into(), + schema_id: schema_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + force: None, + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + schema_id: schema_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/schemas", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2020-12-01"); + 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::SchemaCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SchemaContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Accepted202, + Created201(models::SchemaContract), + Ok200(models::SchemaContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) schema_id: String, + pub(crate) parameters: models::SchemaContract, + 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2020-12-01"); + 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::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SchemaContract = + 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::SchemaContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) schema_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + pub(crate) force: Option, + } + impl Builder { + pub fn force(mut self, force: bool) -> Self { + self.force = Some(force); + 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2020-12-01"); + if let Some(force) = &self.force { + url.query_pairs_mut().append_pair("force", &force.to_string()); + } + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_diagnostic { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.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, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_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, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/diagnostics", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2020-12-01"); + 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::DiagnosticCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::DiagnosticContract), + Ok200(models::DiagnosticContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + 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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2020-12-01"); + 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::DiagnosticContract = + 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::DiagnosticContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + 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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2020-12-01"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2020-12-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_issue { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + expand_comments_attachments: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + expand_comments_attachments: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + issue_id: issue_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_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, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) expand_comments_attachments: 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 expand_comments_attachments(mut self, expand_comments_attachments: bool) -> Self { + self.expand_comments_attachments = Some(expand_comments_attachments); + 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/{}/apis/{}/issues", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2020-12-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(expand_comments_attachments) = &self.expand_comments_attachments { + url.query_pairs_mut() + .append_pair("expandCommentsAttachments", &expand_comments_attachments.to_string()); + } + 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::IssueCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) subscription_id: String, + pub(crate) expand_comments_attachments: Option, + } + impl Builder { + pub fn expand_comments_attachments(mut self, expand_comments_attachments: bool) -> Self { + self.expand_comments_attachments = Some(expand_comments_attachments); + 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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2020-12-01"); + if let Some(expand_comments_attachments) = &self.expand_comments_attachments { + url.query_pairs_mut() + .append_pair("expandCommentsAttachments", &expand_comments_attachments.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::IssueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueContract), + Ok200(models::IssueContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) parameters: models::IssueContract, + 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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2020-12-01"); + 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::IssueContract = + 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::IssueContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) parameters: models::IssueUpdateContract, + 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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2020-12-01"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2020-12-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_issue_comment { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: 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(), + api_id: api_id.into(), + issue_id: issue_id.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, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_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, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_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, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: 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/{}/apis/{}/issues/{}/comments", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2020-12-01"); + 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::IssueCommentCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueCommentContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueCommentContract), + Ok200(models::IssueCommentContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_id: String, + pub(crate) parameters: models::IssueCommentContract, + 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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2020-12-01"); + 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::IssueCommentContract = + 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::IssueCommentContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2020-12-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_issue_attachment { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: 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(), + api_id: api_id.into(), + issue_id: issue_id.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, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_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, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_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, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: 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/{}/apis/{}/issues/{}/attachments", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2020-12-01"); + 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::IssueAttachmentCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueAttachmentContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueAttachmentContract), + Ok200(models::IssueAttachmentContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_id: String, + pub(crate) parameters: models::IssueAttachmentContract, + 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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2020-12-01"); + 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::IssueAttachmentContract = + 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::IssueAttachmentContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2020-12-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_tag_description { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.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, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_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, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_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, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/tagDescriptions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2020-12-01"); + 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::TagDescriptionCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagDescriptionContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::TagDescriptionContract), + Ok200(models::TagDescriptionContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_id: String, + pub(crate) parameters: models::TagDescriptionCreateParameters, + 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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2020-12-01"); + 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::TagDescriptionContract = + 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::TagDescriptionContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2020-12-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 operation { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_tags( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_tags::Builder { + list_by_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + include_not_tagged_operations: None, + } + } + } + pub mod list_by_tags { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) include_not_tagged_operations: 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 include_not_tagged_operations(mut self, include_not_tagged_operations: bool) -> Self { + self.include_not_tagged_operations = Some(include_not_tagged_operations); + 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/{}/apis/{}/operationsByTags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2020-12-01"); + 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()); + } + if let Some(include_not_tagged_operations) = &self.include_not_tagged_operations { + url.query_pairs_mut() + .append_pair("includeNotTaggedOperations", &include_not_tagged_operations.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::TagResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 api_version_set { + use super::models; + 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, + version_set_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(), + version_set_id: version_set_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_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(), + version_set_id: version_set_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + version_set_id: version_set_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_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(), + version_set_id: version_set_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, + version_set_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(), + version_set_id: version_set_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/apiVersionSets", + 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", "2020-12-01"); + 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::ApiVersionSetCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiVersionSetContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::ApiVersionSetContract), + Ok200(models::ApiVersionSetContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_id: String, + pub(crate) parameters: models::ApiVersionSetContract, + 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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2020-12-01"); + 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::ApiVersionSetContract = + 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::ApiVersionSetContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_id: String, + pub(crate) parameters: models::ApiVersionSetUpdateParameters, + 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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2020-12-01"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiVersionSetContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2020-12-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 authorization_server { + use super::models; + 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, + authsid: 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(), + authsid: authsid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: 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(), + authsid: authsid.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + authsid: authsid.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: 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(), + authsid: authsid.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, + authsid: 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(), + authsid: authsid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + authsid: authsid.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/authorizationServers", + 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", "2020-12-01"); + 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::AuthorizationServerCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationServerContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::AuthorizationServerContract), + Ok200(models::AuthorizationServerContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: String, + pub(crate) parameters: models::AuthorizationServerContract, + 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2020-12-01"); + 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::AuthorizationServerContract = + 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::AuthorizationServerContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: String, + pub(crate) parameters: models::AuthorizationServerUpdateContract, + 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2020-12-01"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationServerContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2020-12-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_secrets { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . authsid) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + 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::AuthorizationServerSecretsContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 backend { + use super::models; + 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, + backend_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(), + backend_id: backend_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_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(), + backend_id: backend_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + backend_id: backend_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_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(), + backend_id: backend_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, + backend_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(), + backend_id: backend_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn reconnect( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_id: impl Into, + subscription_id: impl Into, + ) -> reconnect::Builder { + reconnect::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + backend_id: backend_id.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/backends", + 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", "2020-12-01"); + 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::BackendCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) backend_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/{}/backends/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.backend_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackendContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::BackendContract), + Ok200(models::BackendContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) backend_id: String, + pub(crate) parameters: models::BackendContract, + 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/{}/backends/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.backend_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", "2020-12-01"); + 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::BackendContract = + 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::BackendContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) backend_id: String, + pub(crate) parameters: models::BackendUpdateParameters, + 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/{}/backends/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.backend_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", "2020-12-01"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackendContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_service { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -3834,41 +12165,24 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) backend_id: String, + pub(crate) if_match: String, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, - pub(crate) is_key_vault_refresh_failed: 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 is_key_vault_refresh_failed(mut self, is_key_vault_refresh_failed: bool) -> Self { - self.is_key_vault_refresh_failed = Some(is_key_vault_refresh_failed); - self - } - 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.ApiManagement/service/{}/certificates", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.backend_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -3876,31 +12190,15 @@ pub mod certificate { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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()); - } - if let Some(is_key_vault_refresh_failed) = &self.is_key_vault_refresh_failed { - url.query_pairs_mut() - .append_pair("isKeyVaultRefreshFailed", &is_key_vault_refresh_failed.to_string()); - } + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CertificateCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -3915,7 +12213,7 @@ pub mod certificate { } } } - pub mod get { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3944,23 +12242,23 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, + pub(crate) backend_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.certificate_id + &self.backend_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -3974,12 +12272,7 @@ pub mod certificate { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CertificateContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -3994,13 +12287,8 @@ pub mod certificate { } } } - pub mod create_or_update { + pub mod reconnect { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::CertificateContract), - Ok200(models::CertificateContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -4028,29 +12316,28 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, - pub(crate) parameters: models::CertificateCreateOrUpdateParameters, + pub(crate) backend_id: String, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) parameters: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + 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> { + 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/{}/certificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}/reconnect", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.certificate_id + &self.backend_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4058,28 +12345,18 @@ pub mod certificate { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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); - } + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CertificateContract = - 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::CertificateContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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::ErrorResponse = @@ -4094,89 +12371,112 @@ pub mod certificate { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, +} +pub mod cache { + use super::models; + 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(), + top: None, + skip: None, + } } - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_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(), + cache_id: cache_id.into(), + subscription_id: subscription_id.into(), + } } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) certificate_id: String, - pub(crate) if_match: String, - pub(crate) subscription_id: String, + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_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(), + cache_id: cache_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + cache_id: cache_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_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(), + cache_id: cache_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } } - impl Builder { - 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/{}/certificates/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.certificate_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", "2020-12-01"); - 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 fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_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(), + cache_id: cache_id.into(), + subscription_id: subscription_id.into(), } } } - pub mod get_entity_tag { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4205,23 +12505,31 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/certificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.certificate_id + &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::HEAD); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4229,13 +12537,24 @@ pub mod certificate { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + 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 => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CacheCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -4250,7 +12569,7 @@ pub mod certificate { } } } - pub mod refresh_secret { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4279,23 +12598,23 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, + pub(crate) cache_id: String, 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.ApiManagement/service/{}/certificates/{}/refreshSecret", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.certificate_id + &self.cache_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4304,7 +12623,6 @@ pub mod certificate { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); 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)?; @@ -4312,7 +12630,7 @@ pub mod certificate { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CertificateContract = + let rsp_value: models::CacheContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -4330,75 +12648,13 @@ pub mod certificate { } } } -} -pub mod content_type { - use super::models; - 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(), - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - content_type_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(), - content_type_id: content_type_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - content_type_id: 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(), - content_type_id: content_type_id.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - content_type_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(), - content_type_id: content_type_id.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::CacheContract), + Ok200(models::CacheContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -4426,21 +12682,29 @@ pub mod content_type { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) cache_id: String, + pub(crate) parameters: models::CacheContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/contentTypes", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.cache_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4448,17 +12712,27 @@ pub mod content_type { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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::CacheContract = + 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::ContentTypeCollection = + let rsp_value: models::CacheContract = 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)?; @@ -4474,7 +12748,7 @@ pub mod content_type { } } } - pub mod get { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4503,23 +12777,25 @@ pub mod content_type { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, + pub(crate) cache_id: String, + pub(crate) parameters: models::CacheUpdateParameters, + pub(crate) if_match: String, 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.ApiManagement/service/{}/contentTypes/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.content_type_id + &self.cache_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4527,7 +12803,9 @@ pub mod content_type { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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)?; @@ -4535,7 +12813,7 @@ pub mod content_type { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ContentTypeContract = + let rsp_value: models::CacheContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -4553,12 +12831,12 @@ pub mod content_type { } } } - pub mod create_or_update { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::ContentTypeContract), - Ok200(models::ContentTypeContract), + Ok200, + NoContent204, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4587,28 +12865,24 @@ pub mod content_type { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, + pub(crate) cache_id: String, + pub(crate) if_match: String, 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/{}/contentTypes/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.content_type_id + &self.cache_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4616,27 +12890,15 @@ pub mod content_type { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - if let Some(if_match) = &self.if_match { - req_builder = req_builder.header("If-Match", if_match); - } + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ContentTypeContract = - 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::ContentTypeContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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 = @@ -4651,13 +12913,8 @@ pub mod content_type { } } } - pub mod delete { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -4685,24 +12942,23 @@ pub mod content_type { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) if_match: String, + pub(crate) cache_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.content_type_id + &self.cache_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4710,15 +12966,13 @@ pub mod content_type { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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), + 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 = @@ -4734,7 +12988,7 @@ pub mod content_type { } } } -pub mod content_item { +pub mod certificate { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -4742,31 +12996,31 @@ pub mod content_item { &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: 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(), - content_type_id: content_type_id.into(), subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + is_key_vault_refresh_failed: None, } } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: impl Into, - content_item_id: impl Into, + certificate_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(), - content_type_id: content_type_id.into(), - content_item_id: content_item_id.into(), + certificate_id: certificate_id.into(), subscription_id: subscription_id.into(), } } @@ -4774,16 +13028,16 @@ pub mod content_item { &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: impl Into, - content_item_id: impl Into, + certificate_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(), - content_type_id: content_type_id.into(), - content_item_id: content_item_id.into(), + certificate_id: certificate_id.into(), + parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, } @@ -4792,8 +13046,7 @@ pub mod content_item { &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: impl Into, - content_item_id: impl Into, + certificate_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -4801,8 +13054,7 @@ pub mod content_item { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - content_type_id: content_type_id.into(), - content_item_id: content_item_id.into(), + certificate_id: certificate_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -4811,16 +13063,29 @@ pub mod content_item { &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: impl Into, - content_item_id: impl Into, + certificate_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(), - content_type_id: content_type_id.into(), - content_item_id: content_item_id.into(), + certificate_id: certificate_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn refresh_secret( + &self, + resource_group_name: impl Into, + service_name: impl Into, + certificate_id: impl Into, + subscription_id: impl Into, + ) -> refresh_secret::Builder { + refresh_secret::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + certificate_id: certificate_id.into(), subscription_id: subscription_id.into(), } } @@ -4854,19 +13119,37 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) is_key_vault_refresh_failed: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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 is_key_vault_refresh_failed(mut self, is_key_vault_refresh_failed: bool) -> Self { + self.is_key_vault_refresh_failed = Some(is_key_vault_refresh_failed); + 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/{}/contentTypes/{}/contentItems", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.content_type_id + &self.service_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -4878,6 +13161,19 @@ pub mod content_item { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + 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()); + } + if let Some(is_key_vault_refresh_failed) = &self.is_key_vault_refresh_failed { + url.query_pairs_mut() + .append_pair("isKeyVaultRefreshFailed", &is_key_vault_refresh_failed.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)?; @@ -4886,7 +13182,7 @@ pub mod content_item { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ContentItemCollection = + let rsp_value: models::CertificateCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -4933,14 +13229,20 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) content_item_id: String, + pub(crate) certificate_id: String, 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.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_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); @@ -4959,7 +13261,7 @@ pub mod content_item { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ContentItemContract = + let rsp_value: models::CertificateContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -4981,8 +13283,8 @@ pub mod content_item { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::ContentItemContract), - Ok200(models::ContentItemContract), + Created201(models::CertificateContract), + Ok200(models::CertificateContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5011,8 +13313,8 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) content_item_id: String, + pub(crate) certificate_id: String, + pub(crate) parameters: models::CertificateCreateOrUpdateParameters, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -5023,7 +13325,14 @@ pub mod content_item { } 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/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_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); @@ -5034,10 +13343,11 @@ pub mod content_item { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -5045,13 +13355,13 @@ pub mod content_item { 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::ContentItemContract = + let rsp_value: models::CertificateContract = 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::ContentItemContract = + let rsp_value: models::CertificateContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -5103,15 +13413,21 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) content_item_id: String, + pub(crate) certificate_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/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_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); @@ -5129,8 +13445,82 @@ pub mod content_item { let rsp = 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::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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) certificate_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/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 = @@ -5145,7 +13535,7 @@ pub mod content_item { } } } - pub mod get_entity_tag { + pub mod refresh_secret { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5174,17 +13564,23 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) content_item_id: String, + pub(crate) certificate_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}/refreshSecret", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5193,12 +13589,18 @@ pub mod content_item { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CertificateContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -5214,44 +13616,73 @@ pub mod content_item { } } } -pub mod deleted_services { +pub mod content_type { use super::models; 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 { + 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(), } } - pub fn get_by_name( + pub fn get( &self, + resource_group_name: impl Into, service_name: impl Into, + content_type_id: impl Into, subscription_id: impl Into, - location: impl Into, - ) -> get_by_name::Builder { - get_by_name::Builder { + ) -> get::Builder { + get::Builder { client: self.0.clone(), + resource_group_name: resource_group_name.into(), service_name: service_name.into(), + content_type_id: content_type_id.into(), subscription_id: subscription_id.into(), - location: location.into(), } } - pub fn purge( + pub fn create_or_update( &self, + resource_group_name: impl Into, service_name: impl Into, + content_type_id: impl Into, subscription_id: impl Into, - location: impl Into, - ) -> purge::Builder { - purge::Builder { + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + content_type_id: content_type_id.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + content_type_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(), + content_type_id: content_type_id.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), - location: location.into(), } } } - pub mod list_by_subscription { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5278,15 +13709,19 @@ pub mod deleted_services { #[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, } 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.ApiManagement/deletedservices", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes", self.client.endpoint(), - &self.subscription_id + &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(); @@ -5306,7 +13741,7 @@ pub mod deleted_services { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DeletedServicesCollection = + let rsp_value: models::ContentTypeCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -5324,7 +13759,7 @@ pub mod deleted_services { } } } - pub mod get_by_name { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5351,19 +13786,21 @@ pub mod deleted_services { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) content_type_id: String, pub(crate) subscription_id: String, - pub(crate) location: 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.ApiManagement/locations/{}/deletedservices/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", self.client.endpoint(), &self.subscription_id, - &self.location, - &self.service_name + &self.resource_group_name, + &self.service_name, + &self.content_type_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -5383,7 +13820,7 @@ pub mod deleted_services { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DeletedServiceContract = + let rsp_value: models::ContentTypeContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -5401,13 +13838,12 @@ pub mod deleted_services { } } } - pub mod purge { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200, - Accepted202(models::DeletedServiceContract), - NoContent204, + Created201(models::ContentTypeContract), + Ok200(models::ContentTypeContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5434,23 +13870,30 @@ pub mod deleted_services { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) content_type_id: String, pub(crate) subscription_id: String, - pub(crate) location: 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/{}/providers/Microsoft.ApiManagement/locations/{}/deletedservices/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", self.client.endpoint(), &self.subscription_id, - &self.location, - &self.service_name + &self.resource_group_name, + &self.service_name, + &self.content_type_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5458,133 +13901,48 @@ pub mod deleted_services { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = 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::DeletedServiceContract = - 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, - }) - } + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); } - }) - } - } - } -} -pub mod api_management_operations { - use super::models; - 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; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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.ApiManagement/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", "2020-12-01"); let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { + http::StatusCode::CREATED => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OperationListResult = + let rsp_value: models::ContentTypeContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + Ok(Response::Created201(rsp_value)) } - status_code => { + http::StatusCode::OK => { 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 api_management_service_skus { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Gets available SKUs for API Management service"] - pub fn list_available_service_skus( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> list_available_service_skus::Builder { - list_available_service_skus::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - subscription_id: subscription_id.into(), + let rsp_value: models::ContentTypeContract = + 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 list_available_service_skus { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -5612,21 +13970,24 @@ pub mod api_management_service_skus { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) content_type_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> { + 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/{}/skus", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.content_type_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5634,18 +13995,15 @@ pub mod api_management_service_skus { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ResourceSkuResults = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -5661,37 +14019,22 @@ pub mod api_management_service_skus { } } } -pub mod api_management_service { +pub mod content_item { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn restore( - &self, - resource_group_name: impl Into, - service_name: impl Into, - parameters: impl Into, - subscription_id: impl Into, - ) -> restore::Builder { - restore::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn backup( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + content_type_id: impl Into, subscription_id: impl Into, - ) -> backup::Builder { - backup::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - parameters: parameters.into(), + content_type_id: content_type_id.into(), subscription_id: subscription_id.into(), } } @@ -5699,12 +14042,16 @@ pub mod api_management_service { &self, resource_group_name: impl Into, service_name: impl Into, + content_type_id: impl Into, + content_item_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(), + content_type_id: content_type_id.into(), + content_item_id: content_item_id.into(), subscription_id: subscription_id.into(), } } @@ -5712,114 +14059,59 @@ pub mod api_management_service { &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + content_type_id: impl Into, + content_item_id: 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(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_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(), - service_name: service_name.into(), - parameters: parameters.into(), + content_type_id: content_type_id.into(), + content_item_id: content_item_id.into(), subscription_id: subscription_id.into(), + if_match: None, } } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, + content_type_id: impl Into, + content_item_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(), + content_type_id: content_type_id.into(), + content_item_id: content_item_id.into(), + if_match: if_match.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 fn get_sso_token( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> get_sso_token::Builder { - get_sso_token::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - subscription_id: subscription_id.into(), - } - } - 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 get_domain_ownership_identifier(&self, subscription_id: impl Into) -> get_domain_ownership_identifier::Builder { - get_domain_ownership_identifier::Builder { - client: self.0.clone(), - subscription_id: subscription_id.into(), - } - } - pub fn apply_network_configuration_updates( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, + content_type_id: impl Into, + content_item_id: impl Into, subscription_id: impl Into, - ) -> apply_network_configuration_updates::Builder { - apply_network_configuration_updates::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + content_type_id: content_type_id.into(), + content_item_id: content_item_id.into(), subscription_id: subscription_id.into(), - parameters: None, } } } - pub mod restore { + pub mod list_by_service { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -5847,22 +14139,23 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, + pub(crate) content_type_id: String, 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.ApiManagement/service/{}/restore", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.content_type_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5870,8 +14163,7 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -5879,11 +14171,83 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = + let rsp_value: models::ContentItemCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) content_type_id: String, + pub(crate) content_item_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/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContentItemContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(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 = @@ -5898,12 +14262,12 @@ pub mod api_management_service { } } } - pub mod backup { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, + Created201(models::ContentItemContract), + Ok200(models::ContentItemContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5932,22 +14296,22 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, + pub(crate) content_type_id: String, + pub(crate) content_item_id: String, 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/{}/backup", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5955,20 +14319,27 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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); + } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ContentItemContract = + 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::ApiManagementServiceResource = + let rsp_value: models::ContentItemContract = 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 = @@ -5983,8 +14354,13 @@ pub mod api_management_service { } } } - pub mod get { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6012,23 +14388,18 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) content_type_id: String, + pub(crate) content_item_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> { + 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/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6036,18 +14407,15 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -6062,14 +14430,8 @@ pub mod api_management_service { } } } - pub mod create_or_update { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ApiManagementServiceResource), - Created201(models::ApiManagementServiceResource), - Accepted202, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6097,22 +14459,17 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceResource, + pub(crate) content_type_id: String, + pub(crate) content_item_id: String, 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<(), Error>> { Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6120,26 +14477,13 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = - 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::ApiManagementServiceResource = - 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), + 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 = @@ -6154,13 +14498,46 @@ pub mod api_management_service { } } } - pub mod update { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, +} +pub mod deleted_services { + use super::models; + 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 get_by_name( + &self, + service_name: impl Into, + subscription_id: impl Into, + location: impl Into, + ) -> get_by_name::Builder { + get_by_name::Builder { + client: self.0.clone(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + location: location.into(), + } + } + pub fn purge( + &self, + service_name: impl Into, + subscription_id: impl Into, + location: impl Into, + ) -> purge::Builder { + purge::Builder { + client: self.0.clone(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + location: location.into(), + } } + } + pub mod list_by_subscription { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6186,24 +14563,19 @@ pub mod api_management_service { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceUpdateParameters, 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.ApiManagement/service/{}", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/deletedservices", self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name + &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::PATCH); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6211,8 +14583,7 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -6220,11 +14591,10 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = + let rsp_value: models::DeletedServicesCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(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 = @@ -6239,14 +14609,8 @@ pub mod api_management_service { } } } - pub mod delete { + pub mod get_by_name { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202(models::ApiManagementServiceResource), - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6272,23 +14636,23 @@ pub mod api_management_service { #[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) location: 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.ApiManagement/service/{}", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/locations/{}/deletedservices/{}", self.client.endpoint(), &self.subscription_id, - &self.resource_group_name, + &self.location, &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6302,14 +14666,12 @@ pub mod api_management_service { let rsp = 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 => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = + let rsp_value: models::DeletedServiceContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Accepted202(rsp_value)) + Ok(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 = @@ -6324,8 +14686,14 @@ pub mod api_management_service { } } } - pub mod list_by_resource_group { + pub mod purge { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::DeletedServiceContract), + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6351,23 +14719,23 @@ pub mod api_management_service { #[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) location: 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.ApiManagement/service", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/locations/{}/deletedservices/{}", self.client.endpoint(), &self.subscription_id, - &self.resource_group_name + &self.location, + &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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6381,12 +14749,14 @@ pub mod api_management_service { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { + 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::ApiManagementServiceListResult = + let rsp_value: models::DeletedServiceContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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 = @@ -6401,6 +14771,15 @@ pub mod api_management_service { } } } +} +pub mod api_management_operations { + use super::models; + 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; #[derive(Debug, thiserror :: Error)] @@ -6428,18 +14807,11 @@ pub mod api_management_service { #[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> { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.ApiManagement/service", - self.client.endpoint(), - &self.subscription_id - ); + let url_str = &format!("{}/providers/Microsoft.ApiManagement/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); @@ -6458,7 +14830,7 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceListResult = + let rsp_value: models::OperationListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -6476,7 +14848,27 @@ pub mod api_management_service { } } } - pub mod get_sso_token { +} +pub mod api_management_service_skus { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets available SKUs for API Management service"] + pub fn list_available_service_skus( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_available_service_skus::Builder { + list_available_service_skus::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_available_service_skus { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6508,13 +14900,10 @@ pub mod api_management_service { 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.ApiManagement/service/{}/getssotoken", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/skus", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -6522,7 +14911,7 @@ pub mod api_management_service { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6531,7 +14920,6 @@ pub mod api_management_service { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); 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)?; @@ -6539,7 +14927,7 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceGetSsoTokenResult = + let rsp_value: models::ResourceSkuResults = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -6557,8 +14945,166 @@ pub mod api_management_service { } } } - pub mod check_name_availability { +} +pub mod api_management_service { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn restore( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> restore::Builder { + restore::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn backup( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> backup::Builder { + backup::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: 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(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + 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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: 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(), + 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 fn get_sso_token( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> get_sso_token::Builder { + get_sso_token::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + 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 get_domain_ownership_identifier(&self, subscription_id: impl Into) -> get_domain_ownership_identifier::Builder { + get_domain_ownership_identifier::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn apply_network_configuration_updates( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> apply_network_configuration_updates::Builder { + apply_network_configuration_updates::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + } + pub mod restore { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6584,19 +15130,20 @@ pub mod api_management_service { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) parameters: models::ApiManagementServiceCheckNameAvailabilityParameters, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, 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.ApiManagement/checkNameAvailability", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/restore", self.client.endpoint(), - &self.subscription_id + &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(); @@ -6617,10 +15164,11 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceNameAvailabilityResult = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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 = @@ -6635,8 +15183,13 @@ pub mod api_management_service { } } } - pub mod get_domain_ownership_identifier { + pub mod backup { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6662,20 +15215,20 @@ pub mod api_management_service { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, 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.ApiManagement/getDomainOwnershipIdentifier", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backup", self.client.endpoint(), - &self.subscription_id + &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(); @@ -6687,8 +15240,8 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + 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)?; @@ -6696,10 +15249,11 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceGetDomainOwnershipIdentifierResult = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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 = @@ -6711,16 +15265,11 @@ pub mod api_management_service { } } }) - } - } - } - pub mod apply_network_configuration_updates { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, + } } + } + pub mod get { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6749,19 +15298,22 @@ pub mod api_management_service { pub(crate) resource_group_name: String, pub(crate) 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> { + 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/{}/applynetworkconfigurationupdates" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", + 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6769,12 +15321,7 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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 - }; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -6784,9 +15331,8 @@ pub mod api_management_service { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(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 = @@ -6801,114 +15347,14 @@ pub mod api_management_service { } } } -} -pub mod diagnostic { - use super::models; - 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, - diagnostic_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(), - diagnostic_id: diagnostic_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - diagnostic_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(), - diagnostic_id: diagnostic_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - diagnostic_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - diagnostic_id: diagnostic_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - diagnostic_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(), - diagnostic_id: diagnostic_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, - diagnostic_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(), - diagnostic_id: diagnostic_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Created201(models::ApiManagementServiceResource), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6936,28 +15382,14 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) parameters: models::ApiManagementServiceResource, 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> { + 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/{}/diagnostics", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -6965,7 +15397,7 @@ pub mod diagnostic { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6973,16 +15405,8 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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.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)?; @@ -6990,10 +15414,17 @@ pub mod diagnostic { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DiagnosticCollection = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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::ApiManagementServiceResource = + 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 = @@ -7008,8 +15439,13 @@ pub mod diagnostic { } } } - pub mod get { + pub mod update { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7037,23 +15473,22 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, + pub(crate) parameters: models::ApiManagementServiceUpdateParameters, 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.ApiManagement/service/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7061,7 +15496,8 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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)?; @@ -7069,10 +15505,11 @@ pub mod diagnostic { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DiagnosticContract = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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 = @@ -7087,12 +15524,13 @@ pub mod diagnostic { } } } - pub mod create_or_update { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::DiagnosticContract), - Ok200(models::DiagnosticContract), + Ok200, + Accepted202(models::ApiManagementServiceResource), + NoContent204, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7121,29 +15559,21 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, - pub(crate) parameters: models::DiagnosticContract, 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/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7151,28 +15581,20 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let 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::DiagnosticContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Created201(rsp_value)) - } - http::StatusCode::OK => { + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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::DiagnosticContract = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + 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 = @@ -7187,7 +15609,7 @@ pub mod diagnostic { } } } - pub mod update { + pub mod list_by_resource_group { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7215,26 +15637,22 @@ pub mod diagnostic { pub struct Builder { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) diagnostic_id: String, - pub(crate) parameters: models::DiagnosticContract, - pub(crate) if_match: String, 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.ApiManagement/service/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service", self.client.endpoint(), &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.diagnostic_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::PATCH); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7242,9 +15660,7 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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.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)?; @@ -7252,7 +15668,7 @@ pub mod diagnostic { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DiagnosticContract = + let rsp_value: models::ApiManagementServiceListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -7270,13 +15686,8 @@ pub mod diagnostic { } } } - pub mod delete { + pub mod list { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7302,26 +15713,21 @@ pub mod diagnostic { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) diagnostic_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> { + 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/{}/diagnostics/{}", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/service", self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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::DELETE); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7329,15 +15735,18 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -7352,7 +15761,7 @@ pub mod diagnostic { } } } - pub mod get_entity_tag { + pub mod get_sso_token { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7381,23 +15790,24 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/getssotoken", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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::HEAD); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7406,12 +15816,18 @@ pub mod diagnostic { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceGetSsoTokenResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -7426,113 +15842,7 @@ pub mod diagnostic { } } } -} -pub mod email_template { - use super::models; - 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, - template_name: 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(), - template_name: template_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - template_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(), - service_name: service_name.into(), - template_name: template_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - template_name: impl Into, - if_match: impl Into, - parameters: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - template_name: template_name.into(), - if_match: if_match.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - template_name: 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(), - template_name: template_name.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, - template_name: 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(), - template_name: template_name.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod check_name_availability { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7559,38 +15869,23 @@ pub mod email_template { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, + pub(crate) parameters: models::ApiManagementServiceCheckNameAvailabilityParameters, 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> { + 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/{}/templates", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/checkNameAvailability", self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name + &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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7598,16 +15893,8 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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.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)?; @@ -7615,7 +15902,7 @@ pub mod email_template { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateCollection = + let rsp_value: models::ApiManagementServiceNameAvailabilityResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -7633,7 +15920,7 @@ pub mod email_template { } } } - pub mod get { + pub mod get_domain_ownership_identifier { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7660,25 +15947,24 @@ pub mod email_template { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) template_name: String, 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.ApiManagement/service/{}/templates/{}", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier", self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.template_name + &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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7687,6 +15973,7 @@ pub mod email_template { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); 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)?; @@ -7694,7 +15981,7 @@ pub mod email_template { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateContract = + let rsp_value: models::ApiManagementServiceGetDomainOwnershipIdentifierResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -7712,12 +15999,12 @@ pub mod email_template { } } } - pub mod create_or_update { + pub mod apply_network_configuration_updates { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::EmailTemplateContract), - Ok200(models::EmailTemplateContract), + Ok200(models::ApiManagementServiceResource), + Accepted202, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7746,29 +16033,20 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, - pub(crate) parameters: models::EmailTemplateUpdateParameters, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) parameters: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + 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.ApiManagement/service/{}/templates/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.template_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/applynetworkconfigurationupdates" , 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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7776,28 +16054,24 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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); - } + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateContract = - 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::EmailTemplateContract = + let rsp_value: models::ApiManagementServiceResource = 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 = @@ -7812,7 +16086,113 @@ pub mod email_template { } } } - pub mod update { +} +pub mod diagnostic { + use super::models; + 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, + diagnostic_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(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + diagnostic_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(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + diagnostic_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + diagnostic_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(), + diagnostic_id: diagnostic_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, + diagnostic_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(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7841,25 +16221,36 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, - pub(crate) if_match: String, - pub(crate) parameters: models::EmailTemplateUpdateParameters, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/templates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.template_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7867,9 +16258,16 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - req_builder = req_builder.header("If-Match", &self.if_match); - 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(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)?; @@ -7877,7 +16275,7 @@ pub mod email_template { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateContract = + let rsp_value: models::DiagnosticCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -7895,13 +16293,8 @@ pub mod email_template { } } } - pub mod delete { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7929,24 +16322,23 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, - pub(crate) if_match: String, + pub(crate) diagnostic_id: String, 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.ApiManagement/service/{}/templates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.template_name + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7954,15 +16346,18 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -7977,8 +16372,13 @@ pub mod email_template { } } } - pub mod get_entity_tag { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::DiagnosticContract), + Ok200(models::DiagnosticContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8006,23 +16406,29 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/templates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.template_name + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8030,13 +16436,28 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(()), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + 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::DiagnosticContract = + 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 = @@ -8051,162 +16472,7 @@ pub mod email_template { } } } -} -pub mod gateway { - use super::models; - 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, - gateway_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(), - gateway_id: gateway_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_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(), - gateway_id: gateway_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - gateway_id: gateway_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_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(), - gateway_id: gateway_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, - gateway_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(), - gateway_id: gateway_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_keys( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - subscription_id: impl Into, - ) -> list_keys::Builder { - list_keys::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - gateway_id: gateway_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn regenerate_key( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: 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(), - service_name: service_name.into(), - gateway_id: gateway_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn generate_token( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - parameters: impl Into, - subscription_id: impl Into, - ) -> generate_token::Builder { - generate_token::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - gateway_id: gateway_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8235,36 +16501,25 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + pub(crate) if_match: 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> { + 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/{}/gateways", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8272,16 +16527,9 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.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)?; @@ -8289,7 +16537,7 @@ pub mod gateway { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayCollection = + let rsp_value: models::DiagnosticContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -8307,8 +16555,13 @@ pub mod gateway { } } } - pub mod get { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8336,23 +16589,24 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, + pub(crate) diagnostic_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> { + 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/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8360,18 +16614,15 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -8386,13 +16637,8 @@ pub mod gateway { } } } - pub mod create_or_update { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::GatewayContract), - Ok200(models::GatewayContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8420,29 +16666,23 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) parameters: models::GatewayContract, + pub(crate) diagnostic_id: String, 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> { + 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/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8450,28 +16690,13 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::GatewayContract = - 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::GatewayContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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 = @@ -8486,7 +16711,113 @@ pub mod gateway { } } } - pub mod update { +} +pub mod email_template { + use super::models; + 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, + template_name: 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(), + template_name: template_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + template_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(), + service_name: service_name.into(), + template_name: template_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + template_name: impl Into, + if_match: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + template_name: template_name.into(), + if_match: if_match.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + template_name: 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(), + template_name: template_name.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, + template_name: 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(), + template_name: template_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8515,25 +16846,36 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) parameters: models::GatewayContract, - pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.gateway_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8541,9 +16883,16 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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.header("If-Match", &self.if_match); + 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)?; @@ -8551,7 +16900,7 @@ pub mod gateway { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayContract = + let rsp_value: models::EmailTemplateCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -8569,13 +16918,8 @@ pub mod gateway { } } } - pub mod delete { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8603,24 +16947,23 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) if_match: String, + pub(crate) template_name: String, 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.ApiManagement/service/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8628,15 +16971,18 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EmailTemplateContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -8651,8 +16997,13 @@ pub mod gateway { } } } - pub mod get_entity_tag { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::EmailTemplateContract), + Ok200(models::EmailTemplateContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8680,23 +17031,29 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, + pub(crate) template_name: String, + pub(crate) parameters: models::EmailTemplateUpdateParameters, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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::HEAD); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8704,13 +17061,28 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(()), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EmailTemplateContract = + 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::EmailTemplateContract = + 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 = @@ -8725,7 +17097,7 @@ pub mod gateway { } } } - pub mod list_keys { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8754,23 +17126,25 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, + pub(crate) template_name: String, + pub(crate) if_match: String, + pub(crate) parameters: models::EmailTemplateUpdateParameters, 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.ApiManagement/service/{}/gateways/{}/listKeys", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8778,8 +17152,9 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.header("If-Match", &self.if_match); + 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)?; @@ -8787,7 +17162,7 @@ pub mod gateway { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayKeysContract = + let rsp_value: models::EmailTemplateContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -8805,8 +17180,13 @@ pub mod gateway { } } } - pub mod regenerate_key { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8834,24 +17214,24 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) parameters: models::GatewayKeyRegenerationRequestContract, + pub(crate) template_name: 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<(), Error>> { + 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/{}/gateways/{}/regenerateKey", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8859,14 +17239,15 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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.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::NO_CONTENT => Ok(()), + 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 = @@ -8881,7 +17262,7 @@ pub mod gateway { } } } - pub mod generate_token { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8910,24 +17291,23 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) parameters: models::GatewayTokenRequestContract, + pub(crate) template_name: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/generateToken", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8935,19 +17315,13 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayTokenContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -8963,7 +17337,7 @@ pub mod gateway { } } } -pub mod gateway_hostname_configuration { +pub mod gateway { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -8971,14 +17345,12 @@ pub mod gateway_hostname_configuration { &self, resource_group_name: impl Into, service_name: impl Into, - gateway_id: 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(), - gateway_id: gateway_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, @@ -8990,7 +17362,6 @@ pub mod gateway_hostname_configuration { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - hc_id: impl Into, subscription_id: impl Into, ) -> get::Builder { get::Builder { @@ -8998,7 +17369,6 @@ pub mod gateway_hostname_configuration { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - hc_id: hc_id.into(), subscription_id: subscription_id.into(), } } @@ -9007,8 +17377,7 @@ pub mod gateway_hostname_configuration { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - hc_id: impl Into, - parameters: impl Into, + parameters: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -9016,18 +17385,35 @@ pub mod gateway_hostname_configuration { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - hc_id: hc_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, } } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - hc_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -9036,7 +17422,6 @@ pub mod gateway_hostname_configuration { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - hc_id: hc_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -9046,7 +17431,6 @@ pub mod gateway_hostname_configuration { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - hc_id: impl Into, subscription_id: impl Into, ) -> get_entity_tag::Builder { get_entity_tag::Builder { @@ -9054,7 +17438,55 @@ pub mod gateway_hostname_configuration { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - hc_id: hc_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_keys( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + subscription_id: impl Into, + ) -> list_keys::Builder { + list_keys::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn regenerate_key( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: 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(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn generate_token( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> generate_token::Builder { + generate_token::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + parameters: parameters.into(), subscription_id: subscription_id.into(), } } @@ -9088,7 +17520,6 @@ pub mod gateway_hostname_configuration { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, @@ -9107,12 +17538,15 @@ pub mod gateway_hostname_configuration { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/gateways/{}/hostnameConfigurations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/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); @@ -9140,7 +17574,7 @@ pub mod gateway_hostname_configuration { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayHostnameConfigurationCollection = + let rsp_value: models::GatewayCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -9188,15 +17622,19 @@ pub mod gateway_hostname_configuration { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) hc_id: String, 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.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_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); @@ -9215,7 +17653,7 @@ pub mod gateway_hostname_configuration { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayHostnameConfigurationContract = + let rsp_value: models::GatewayContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -9237,8 +17675,8 @@ pub mod gateway_hostname_configuration { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::GatewayHostnameConfigurationContract), - Ok200(models::GatewayHostnameConfigurationContract), + Created201(models::GatewayContract), + Ok200(models::GatewayContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9268,8 +17706,7 @@ pub mod gateway_hostname_configuration { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) hc_id: String, - pub(crate) parameters: models::GatewayHostnameConfigurationContract, + pub(crate) parameters: models::GatewayContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -9280,7 +17717,14 @@ pub mod gateway_hostname_configuration { } 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/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_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); @@ -9291,11 +17735,11 @@ pub mod gateway_hostname_configuration { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + 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.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)?; @@ -9303,13 +17747,13 @@ pub mod gateway_hostname_configuration { 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::GatewayHostnameConfigurationContract = + let rsp_value: models::GatewayContract = 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::GatewayHostnameConfigurationContract = + let rsp_value: models::GatewayContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -9327,13 +17771,8 @@ pub mod gateway_hostname_configuration { } } } - pub mod delete { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9362,17 +17801,24 @@ pub mod gateway_hostname_configuration { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) hc_id: String, + pub(crate) parameters: models::GatewayContract, pub(crate) if_match: String, 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.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9380,15 +17826,20 @@ pub mod gateway_hostname_configuration { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + 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.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), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -9403,8 +17854,13 @@ pub mod gateway_hostname_configuration { } } } - pub mod get_entity_tag { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9433,16 +17889,23 @@ pub mod gateway_hostname_configuration { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) hc_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<(), Error>> { + 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/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9450,13 +17913,15 @@ pub mod gateway_hostname_configuration { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + 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(()), + 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 = @@ -9471,83 +17936,7 @@ pub mod gateway_hostname_configuration { } } } -} -pub mod gateway_api { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_service( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: 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(), - gateway_id: gateway_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - api_id: 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(), - gateway_id: gateway_id.into(), - api_id: api_id.into(), - subscription_id: subscription_id.into(), - parameters: None, - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - api_id: 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(), - gateway_id: gateway_id.into(), - api_id: api_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn get_entity_tag( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - api_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(), - gateway_id: gateway_id.into(), - api_id: api_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9578,27 +17967,12 @@ pub mod gateway_api { pub(crate) service_name: String, pub(crate) gateway_id: 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> { + 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/{}/gateways/{}/apis", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -9607,7 +17981,7 @@ pub mod gateway_api { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9615,27 +17989,13 @@ pub mod gateway_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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::ApiCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -9650,13 +18010,8 @@ pub mod gateway_api { } } } - pub mod create_or_update { + pub mod list_keys { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ApiContract), - Ok200(models::ApiContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9685,29 +18040,22 @@ pub mod gateway_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) api_id: 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> { + 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/{}/gateways/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/listKeys", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id, - &self.api_id + &self.gateway_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9715,28 +18063,18 @@ pub mod gateway_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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 - }; + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiContract = - 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::ApiContract = + let rsp_value: models::GatewayKeysContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -9752,13 +18090,8 @@ pub mod gateway_api { } } } - pub mod delete { + pub mod regenerate_key { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9787,24 +18120,23 @@ pub mod gateway_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) api_id: String, + pub(crate) parameters: models::GatewayKeyRegenerationRequestContract, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/regenerateKey", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id, - &self.api_id + &self.gateway_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9812,14 +18144,14 @@ pub mod gateway_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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::NO_CONTENT => Ok(Response::NoContent204), + 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::ErrorResponse = @@ -9834,7 +18166,7 @@ pub mod gateway_api { } } } - pub mod get_entity_tag { + pub mod generate_token { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9864,24 +18196,23 @@ pub mod gateway_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) api_id: String, + pub(crate) parameters: models::GatewayTokenRequestContract, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/gateways/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/generateToken", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id, - &self.api_id + &self.gateway_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9889,13 +18220,19 @@ pub mod gateway_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayTokenContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -9911,7 +18248,7 @@ pub mod gateway_api { } } } -pub mod gateway_certificate_authority { +pub mod gateway_hostname_configuration { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -9938,7 +18275,7 @@ pub mod gateway_certificate_authority { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - certificate_id: impl Into, + hc_id: impl Into, subscription_id: impl Into, ) -> get::Builder { get::Builder { @@ -9946,7 +18283,7 @@ pub mod gateway_certificate_authority { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - certificate_id: certificate_id.into(), + hc_id: hc_id.into(), subscription_id: subscription_id.into(), } } @@ -9955,8 +18292,8 @@ pub mod gateway_certificate_authority { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - certificate_id: impl Into, - parameters: impl Into, + hc_id: impl Into, + parameters: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -9964,7 +18301,7 @@ pub mod gateway_certificate_authority { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - certificate_id: certificate_id.into(), + hc_id: hc_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -9975,7 +18312,7 @@ pub mod gateway_certificate_authority { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - certificate_id: impl Into, + hc_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -9984,7 +18321,7 @@ pub mod gateway_certificate_authority { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - certificate_id: certificate_id.into(), + hc_id: hc_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -9994,7 +18331,7 @@ pub mod gateway_certificate_authority { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - certificate_id: impl Into, + hc_id: impl Into, subscription_id: impl Into, ) -> get_entity_tag::Builder { get_entity_tag::Builder { @@ -10002,7 +18339,7 @@ pub mod gateway_certificate_authority { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - certificate_id: certificate_id.into(), + hc_id: hc_id.into(), subscription_id: subscription_id.into(), } } @@ -10057,10 +18394,10 @@ pub mod gateway_certificate_authority { } pub fn into_future( self, - ) -> futures::future::BoxFuture<'static, std::result::Result> + ) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_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); @@ -10088,7 +18425,7 @@ pub mod gateway_certificate_authority { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayCertificateAuthorityCollection = + let rsp_value: models::GatewayHostnameConfigurationCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -10136,15 +18473,15 @@ pub mod gateway_certificate_authority { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) certificate_id: String, + pub(crate) hc_id: String, pub(crate) subscription_id: String, } impl Builder { pub fn into_future( self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + ) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_id) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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); @@ -10163,7 +18500,7 @@ pub mod gateway_certificate_authority { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayCertificateAuthorityContract = + let rsp_value: models::GatewayHostnameConfigurationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -10185,8 +18522,8 @@ pub mod gateway_certificate_authority { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::GatewayCertificateAuthorityContract), - Ok200(models::GatewayCertificateAuthorityContract), + Created201(models::GatewayHostnameConfigurationContract), + Ok200(models::GatewayHostnameConfigurationContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -10216,8 +18553,8 @@ pub mod gateway_certificate_authority { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) certificate_id: String, - pub(crate) parameters: models::GatewayCertificateAuthorityContract, + pub(crate) hc_id: String, + pub(crate) parameters: models::GatewayHostnameConfigurationContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -10228,7 +18565,7 @@ pub mod gateway_certificate_authority { } 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/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_id) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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); @@ -10251,13 +18588,13 @@ pub mod gateway_certificate_authority { 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::GatewayCertificateAuthorityContract = + let rsp_value: models::GatewayHostnameConfigurationContract = 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::GatewayCertificateAuthorityContract = + let rsp_value: models::GatewayHostnameConfigurationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -10310,14 +18647,14 @@ pub mod gateway_certificate_authority { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) certificate_id: String, + pub(crate) hc_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/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_id) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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); @@ -10381,13 +18718,13 @@ pub mod gateway_certificate_authority { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) certificate_id: String, + pub(crate) hc_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/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_id) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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); @@ -10420,7 +18757,7 @@ pub mod gateway_certificate_authority { } } } -pub mod group { +pub mod gateway_api { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -10428,84 +18765,52 @@ pub mod group { &self, resource_group_name: impl Into, service_name: impl Into, + gateway_id: 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(), + gateway_id: gateway_id.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, - group_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(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), - } - } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - parameters: impl Into, + gateway_id: impl Into, + api_id: 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(), - group_id: group_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - group_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - group_id: group_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), + gateway_id: gateway_id.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), + parameters: None, } } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - if_match: impl Into, + gateway_id: impl Into, + api_id: 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(), - group_id: group_id.into(), - if_match: if_match.into(), + gateway_id: gateway_id.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), } } @@ -10513,14 +18818,16 @@ pub mod group { &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, + gateway_id: impl Into, + api_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(), - group_id: group_id.into(), + gateway_id: gateway_id.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), } } @@ -10554,6 +18861,7 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) gateway_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, @@ -10572,14 +18880,15 @@ pub mod group { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/groups", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.gateway_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -10595,201 +18904,22 @@ pub mod group { 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::GroupCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) group_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/{}/groups/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.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", "2020-12-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GroupContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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; - #[derive(Debug)] - pub enum Response { - Created201(models::GroupContract), - Ok200(models::GroupContract), - } - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) group_id: String, - pub(crate) parameters: models::GroupCreateParameters, - 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/{}/groups/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.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::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", "2020-12-01"); - 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); + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GroupContract = - 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::GroupContract = + let rsp_value: models::ApiCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -10805,8 +18935,13 @@ pub mod group { } } } - pub mod update { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ApiContract), + Ok200(models::ApiContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -10834,25 +18969,30 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) parameters: models::GroupUpdateParameters, - pub(crate) if_match: String, + pub(crate) gateway_id: String, + pub(crate) api_id: String, pub(crate) subscription_id: String, + pub(crate) parameters: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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.ApiManagement/service/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.gateway_id, + &self.api_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -10860,19 +19000,28 @@ pub mod group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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.header("If-Match", &self.if_match); + 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::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiContract = + 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::GroupContract = + let rsp_value: models::ApiContract = 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)?; @@ -10922,20 +19071,21 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) if_match: String, + pub(crate) gateway_id: String, + pub(crate) api_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/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.gateway_id, + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -10947,7 +19097,6 @@ pub mod group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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)?; @@ -10999,19 +19148,21 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, + pub(crate) gateway_id: String, + pub(crate) api_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/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.gateway_id, + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -11045,81 +19196,103 @@ pub mod group { } } } -pub mod group_user { +pub mod gateway_certificate_authority { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, + gateway_id: impl Into, subscription_id: impl Into, - ) -> list::Builder { - list::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - group_id: group_id.into(), + gateway_id: gateway_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, } } - pub fn create( + pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - user_id: impl Into, + gateway_id: impl Into, + certificate_id: impl Into, subscription_id: impl Into, - ) -> create::Builder { - create::Builder { + ) -> get::Builder { + get::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - group_id: group_id.into(), - user_id: user_id.into(), + gateway_id: gateway_id.into(), + certificate_id: certificate_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + certificate_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(), + gateway_id: gateway_id.into(), + certificate_id: certificate_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, - group_id: impl Into, - user_id: impl Into, + gateway_id: impl Into, + certificate_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(), - group_id: group_id.into(), - user_id: user_id.into(), + gateway_id: gateway_id.into(), + certificate_id: certificate_id.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } - pub fn check_entity_exists( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - user_id: impl Into, + gateway_id: impl Into, + certificate_id: impl Into, subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - group_id: group_id.into(), - user_id: user_id.into(), + gateway_id: gateway_id.into(), + certificate_id: certificate_id.into(), subscription_id: subscription_id.into(), } } } - pub mod list { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11148,7 +19321,7 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, + pub(crate) gateway_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, @@ -11167,16 +19340,12 @@ pub mod group_user { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/groups/{}/users", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_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); @@ -11204,7 +19373,7 @@ pub mod group_user { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::UserCollection = + let rsp_value: models::GatewayCertificateAuthorityCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -11222,12 +19391,87 @@ pub mod group_user { } } } - pub mod create { + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) gateway_id: String, + pub(crate) certificate_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/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayCertificateAuthorityContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; #[derive(Debug)] pub enum Response { - Created201(models::UserContract), - Ok200(models::UserContract), + Created201(models::GatewayCertificateAuthorityContract), + Ok200(models::GatewayCertificateAuthorityContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11256,22 +19500,20 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) user_id: String, + pub(crate) gateway_id: String, + pub(crate) certificate_id: String, + pub(crate) parameters: models::GatewayCertificateAuthorityContract, 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/{}/groups/{}/users/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id, - &self.user_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_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); @@ -11282,7 +19524,11 @@ pub mod group_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - let req_body = azure_core::EMPTY_BODY; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + 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)?; @@ -11290,13 +19536,13 @@ pub mod group_user { 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::UserContract = + let rsp_value: models::GatewayCertificateAuthorityContract = 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::UserContract = + let rsp_value: models::GatewayCertificateAuthorityContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -11348,22 +19594,15 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) user_id: String, + pub(crate) gateway_id: String, + pub(crate) certificate_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/{}/groups/{}/users/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id, - &self.user_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_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); @@ -11374,6 +19613,7 @@ pub mod group_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + 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)?; @@ -11396,12 +19636,10 @@ pub mod group_user { } } } - pub mod check_entity_exists { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Error response #response_type")] - NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -11427,22 +19665,14 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) user_id: String, + pub(crate) gateway_id: String, + pub(crate) certificate_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/{}/groups/{}/users/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id, - &self.user_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_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); @@ -11459,8 +19689,7 @@ pub mod group_user { let 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(()), - http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + 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 = @@ -11476,7 +19705,7 @@ pub mod group_user { } } } -pub mod identity_provider { +pub mod group { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -11491,20 +19720,23 @@ pub mod identity_provider { 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, - identity_provider_name: impl Into, + group_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(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -11512,15 +19744,15 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, - parameters: impl Into, + group_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(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -11530,8 +19762,8 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, - parameters: impl Into, + group_id: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -11539,7 +19771,7 @@ pub mod identity_provider { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), @@ -11549,7 +19781,7 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, + group_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -11557,7 +19789,7 @@ pub mod identity_provider { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -11566,29 +19798,14 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, + group_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(), - identity_provider_name: identity_provider_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_secrets( - &self, - resource_group_name: impl Into, - service_name: impl Into, - identity_provider_name: impl Into, - subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -11623,12 +19840,27 @@ pub mod identity_provider { 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 into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/identityProviders", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -11644,6 +19876,15 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + 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)?; @@ -11652,7 +19893,7 @@ pub mod identity_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IdentityProviderList = + let rsp_value: models::GroupCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -11699,19 +19940,19 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, + pub(crate) group_id: String, 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.ApiManagement/service/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -11731,7 +19972,7 @@ pub mod identity_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IdentityProviderContract = + let rsp_value: models::GroupContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -11753,8 +19994,8 @@ pub mod identity_provider { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::IdentityProviderContract), - Ok200(models::IdentityProviderContract), + Created201(models::GroupContract), + Ok200(models::GroupContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11783,8 +20024,8 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, - pub(crate) parameters: models::IdentityProviderCreateContract, + pub(crate) group_id: String, + pub(crate) parameters: models::GroupCreateParameters, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -11796,12 +20037,12 @@ pub mod identity_provider { 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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -11825,13 +20066,13 @@ pub mod identity_provider { 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::IdentityProviderContract = + let rsp_value: models::GroupContract = 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::IdentityProviderContract = + let rsp_value: models::GroupContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -11878,21 +20119,21 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, - pub(crate) parameters: models::IdentityProviderUpdateParameters, + pub(crate) group_id: String, + pub(crate) parameters: models::GroupUpdateParameters, pub(crate) if_match: String, 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.ApiManagement/service/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -11904,20 +20145,102 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GroupContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) group_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/{}/groups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.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::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", "2020-12-01"); 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IdentityProviderContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -11932,13 +20255,8 @@ pub mod identity_provider { } } } - pub mod delete { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -11966,24 +20284,23 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, - pub(crate) if_match: String, + pub(crate) group_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.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::DELETE); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11991,15 +20308,13 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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), + 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 = @@ -12014,7 +20329,82 @@ pub mod identity_provider { } } } - pub mod get_entity_tag { +} +pub mod group_user { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn create( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + user_id: 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(), + group_id: group_id.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12043,23 +20433,38 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, + pub(crate) group_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.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::HEAD); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12067,13 +20472,27 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + 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 => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UserCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -12088,8 +20507,13 @@ pub mod identity_provider { } } } - pub mod list_secrets { + pub mod create { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::UserContract), + Ok200(models::UserContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12117,16 +20541,25 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, + pub(crate) group_id: String, + pub(crate) user_id: String, 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.ApiManagement/service/{}/identityProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . identity_provider_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.group_id, + &self.user_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12135,17 +20568,22 @@ pub mod identity_provider { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); 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::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UserContract = + 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::ClientSecretContract = + let rsp_value: models::UserContract = 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)?; @@ -12161,45 +20599,13 @@ pub mod identity_provider { } } } -} -pub mod issue { - use super::models; - 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, - issue_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(), - issue_id: issue_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12221,42 +20627,31 @@ pub mod issue { ResponseBytes(#[source] azure_core::error::Error), #[error("Failed to deserialize response, body: {1:?}")] Deserialize(#[source] 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> { + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) group_id: String, + pub(crate) user_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/{}/issues", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.group_id, + &self.user_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12264,27 +20659,14 @@ pub mod issue { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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::IssueCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -12299,10 +20681,12 @@ pub mod issue { } } } - pub mod get { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -12328,23 +20712,25 @@ pub mod issue { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) issue_id: String, + pub(crate) group_id: String, + pub(crate) user_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/issues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.issue_id + &self.group_id, + &self.user_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12358,12 +20744,8 @@ pub mod issue { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IssueContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + http::StatusCode::NO_CONTENT => Ok(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -12379,7 +20761,7 @@ pub mod issue { } } } -pub mod logger { +pub mod identity_provider { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -12394,23 +20776,20 @@ pub mod logger { 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, - logger_id: impl Into, + identity_provider_name: 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(), - logger_id: logger_id.into(), + identity_provider_name: identity_provider_name.into(), subscription_id: subscription_id.into(), } } @@ -12418,15 +20797,15 @@ pub mod logger { &self, resource_group_name: impl Into, service_name: impl Into, - logger_id: impl Into, - parameters: impl Into, + identity_provider_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(), service_name: service_name.into(), - logger_id: logger_id.into(), + identity_provider_name: identity_provider_name.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -12436,8 +20815,8 @@ pub mod logger { &self, resource_group_name: impl Into, service_name: impl Into, - logger_id: impl Into, - parameters: impl Into, + identity_provider_name: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -12445,7 +20824,7 @@ pub mod logger { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - logger_id: logger_id.into(), + identity_provider_name: identity_provider_name.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), @@ -12455,7 +20834,7 @@ pub mod logger { &self, resource_group_name: impl Into, service_name: impl Into, - logger_id: impl Into, + identity_provider_name: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -12463,7 +20842,7 @@ pub mod logger { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - logger_id: logger_id.into(), + identity_provider_name: identity_provider_name.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -12472,14 +20851,29 @@ pub mod logger { &self, resource_group_name: impl Into, service_name: impl Into, - logger_id: impl Into, + identity_provider_name: 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(), - logger_id: logger_id.into(), + identity_provider_name: identity_provider_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + identity_provider_name: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + identity_provider_name: identity_provider_name.into(), subscription_id: subscription_id.into(), } } @@ -12514,27 +20908,12 @@ pub mod logger { 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> { + 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/{}/loggers", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -12550,15 +20929,6 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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)?; @@ -12567,7 +20937,7 @@ pub mod logger { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::LoggerCollection = + let rsp_value: models::IdentityProviderList = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -12614,19 +20984,19 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, + pub(crate) identity_provider_name: String, 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.ApiManagement/service/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.identity_provider_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -12646,7 +21016,7 @@ pub mod logger { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::LoggerContract = + let rsp_value: models::IdentityProviderContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -12668,8 +21038,8 @@ pub mod logger { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::LoggerContract), - Ok200(models::LoggerContract), + Created201(models::IdentityProviderContract), + Ok200(models::IdentityProviderContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12698,8 +21068,8 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, - pub(crate) parameters: models::LoggerContract, + pub(crate) identity_provider_name: String, + pub(crate) parameters: models::IdentityProviderCreateContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -12711,12 +21081,12 @@ pub mod logger { 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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.identity_provider_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -12740,13 +21110,13 @@ pub mod logger { 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::LoggerContract = + let rsp_value: models::IdentityProviderContract = 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::LoggerContract = + let rsp_value: models::IdentityProviderContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -12793,21 +21163,21 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, - pub(crate) parameters: models::LoggerUpdateContract, + pub(crate) identity_provider_name: String, + pub(crate) parameters: models::IdentityProviderUpdateParameters, pub(crate) if_match: String, 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.ApiManagement/service/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.identity_provider_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -12829,7 +21199,7 @@ pub mod logger { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::LoggerContract = + let rsp_value: models::IdentityProviderContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -12847,90 +21217,13 @@ pub mod logger { } } } - pub mod delete { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) logger_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/{}/loggers/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.logger_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", "2020-12-01"); - 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 { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12958,23 +21251,24 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, + pub(crate) identity_provider_name: 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<(), Error>> { + 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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.identity_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::HEAD); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12982,13 +21276,15 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + 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(()), + 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 = @@ -13003,144 +21299,7 @@ pub mod logger { } } } -} -pub mod named_value { - use super::models; - 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, - is_key_vault_refresh_failed: None, - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - named_value_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(), - named_value_id: named_value_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - named_value_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(), - named_value_id: named_value_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - named_value_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - named_value_id: named_value_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - named_value_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(), - named_value_id: named_value_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, - named_value_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(), - named_value_id: named_value_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_value( - &self, - resource_group_name: impl Into, - service_name: impl Into, - named_value_id: impl Into, - subscription_id: impl Into, - ) -> list_value::Builder { - list_value::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - named_value_id: named_value_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn refresh_secret( - &self, - resource_group_name: impl Into, - service_name: impl Into, - named_value_id: impl Into, - subscription_id: impl Into, - ) -> refresh_secret::Builder { - refresh_secret::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - named_value_id: named_value_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13169,41 +21328,23 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) identity_provider_name: String, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, - pub(crate) is_key_vault_refresh_failed: 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 is_key_vault_refresh_failed(mut self, is_key_vault_refresh_failed: bool) -> Self { - self.is_key_vault_refresh_failed = Some(is_key_vault_refresh_failed); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/namedValues", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.identity_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13211,31 +21352,13 @@ pub mod named_value { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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()); - } - if let Some(is_key_vault_refresh_failed) = &self.is_key_vault_refresh_failed { - url.query_pairs_mut() - .append_pair("isKeyVaultRefreshFailed", &is_key_vault_refresh_failed.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::NamedValueCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -13250,7 +21373,7 @@ pub mod named_value { } } } - pub mod get { + pub mod list_secrets { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13279,23 +21402,16 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, + pub(crate) identity_provider_name: String, 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.ApiManagement/service/{}/namedValues/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.named_value_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . identity_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13304,6 +21420,7 @@ pub mod named_value { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); 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)?; @@ -13311,7 +21428,7 @@ pub mod named_value { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NamedValueContract = + let rsp_value: models::ClientSecretContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -13329,14 +21446,45 @@ pub mod named_value { } } } - pub mod create_or_update { +} +pub mod issue { + use super::models; + 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, + issue_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(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Created201(models::NamedValueContract), - Ok200(models::NamedValueContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13364,29 +21512,36 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, - pub(crate) parameters: models::NamedValueCreateContract, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + 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> { + 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/{}/namedValues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/issues", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.named_value_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13394,28 +21549,26 @@ pub mod named_value { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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); + 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::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NamedValueContract = - 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::NamedValueContract = + let rsp_value: models::IssueCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -13431,13 +21584,8 @@ pub mod named_value { } } } - pub mod update { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Ok200(models::NamedValueContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13465,25 +21613,23 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, - pub(crate) parameters: models::NamedValueUpdateParameters, - pub(crate) if_match: String, + pub(crate) issue_id: String, 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.ApiManagement/service/{}/namedValues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/issues/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.named_value_id + &self.issue_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13491,20 +21637,17 @@ pub mod named_value { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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.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::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::NamedValueContract = + let rsp_value: models::IssueContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -13520,13 +21663,114 @@ pub mod named_value { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, +} +pub mod logger { + use super::models; + 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, + logger_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(), + logger_id: logger_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + logger_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(), + logger_id: logger_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + logger_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + logger_id: logger_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + logger_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(), + logger_id: logger_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, + logger_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(), + logger_id: logger_id.into(), + subscription_id: subscription_id.into(), + } } + } + pub mod list_by_service { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13554,24 +21798,36 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, - pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/namedValues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.named_value_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13579,15 +21835,27 @@ pub mod named_value { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - req_builder = req_builder.header("If-Match", &self.if_match); + 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 => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoggerCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -13602,7 +21870,7 @@ pub mod named_value { } } } - pub mod get_entity_tag { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13631,23 +21899,23 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, + pub(crate) logger_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/namedValues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.named_value_id + &self.logger_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13661,7 +21929,12 @@ pub mod named_value { let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoggerContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -13676,8 +21949,13 @@ pub mod named_value { } } } - pub mod list_value { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::LoggerContract), + Ok200(models::LoggerContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13705,23 +21983,29 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, + pub(crate) logger_id: String, + pub(crate) parameters: models::LoggerContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/namedValues/{}/listValue", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.named_value_id + &self.logger_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13729,18 +22013,27 @@ pub mod named_value { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + 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::LoggerContract = + 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::NamedValueSecretContract = + let rsp_value: models::LoggerContract = 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)?; @@ -13756,13 +22049,8 @@ pub mod named_value { } } } - pub mod refresh_secret { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Ok200(models::NamedValueContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13790,23 +22078,25 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, + pub(crate) logger_id: String, + pub(crate) parameters: models::LoggerUpdateContract, + pub(crate) if_match: String, 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.ApiManagement/service/{}/namedValues/{}/refreshSecret", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.named_value_id + &self.logger_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13814,19 +22104,19 @@ pub mod named_value { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + 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.header("If-Match", &self.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::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::NamedValueContract = + let rsp_value: models::LoggerContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -13842,42 +22132,13 @@ pub mod named_value { } } } -} -pub mod network_status { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_service( - &self, - subscription_id: impl Into, - resource_group_name: impl Into, - service_name: impl Into, - ) -> list_by_service::Builder { - list_by_service::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_by_location( - &self, - subscription_id: impl Into, - resource_group_name: impl Into, - service_name: impl Into, - location_name: impl Into, - ) -> list_by_location::Builder { - list_by_location::Builder { - client: self.0.clone(), - subscription_id: subscription_id.into(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - location_name: location_name.into(), - } - } - } - pub mod list_by_service { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13903,25 +22164,26 @@ pub mod network_status { #[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) logger_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, Error>> { + 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/{}/networkstatus", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.logger_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13929,18 +22191,15 @@ pub mod network_status { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + 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 => { - 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) - } + 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 = @@ -13955,7 +22214,7 @@ pub mod network_status { } } } - pub mod list_by_location { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13982,25 +22241,25 @@ pub mod network_status { #[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) location_name: String, + pub(crate) logger_id: String, + 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/locations/{}/networkstatus", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.location_name + &self.logger_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14014,12 +22273,7 @@ pub mod network_status { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NetworkStatusContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -14033,56 +22287,141 @@ pub mod network_status { }) } } - } -} -pub mod notification { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_service( + } +} +pub mod named_value { + use super::models; + 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, + is_key_vault_refresh_failed: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_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(), + named_value_id: named_value_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_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(), + named_value_id: named_value_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + named_value_id: named_value_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_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(), + named_value_id: named_value_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, + named_value_id: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + named_value_id: named_value_id.into(), subscription_id: subscription_id.into(), - top: None, - skip: None, } } - pub fn get( + pub fn list_value( &self, resource_group_name: impl Into, service_name: impl Into, - notification_name: impl Into, + named_value_id: impl Into, subscription_id: impl Into, - ) -> get::Builder { - get::Builder { + ) -> list_value::Builder { + list_value::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - notification_name: notification_name.into(), + named_value_id: named_value_id.into(), subscription_id: subscription_id.into(), } } - pub fn create_or_update( + pub fn refresh_secret( &self, resource_group_name: impl Into, service_name: impl Into, - notification_name: impl Into, + named_value_id: impl Into, subscription_id: impl Into, - ) -> create_or_update::Builder { - create_or_update::Builder { + ) -> refresh_secret::Builder { + refresh_secret::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - notification_name: notification_name.into(), + named_value_id: named_value_id.into(), subscription_id: subscription_id.into(), - if_match: None, } } } @@ -14116,10 +22455,16 @@ pub mod notification { 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, + pub(crate) is_key_vault_refresh_failed: 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 @@ -14128,10 +22473,14 @@ pub mod notification { self.skip = Some(skip); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn is_key_vault_refresh_failed(mut self, is_key_vault_refresh_failed: bool) -> Self { + self.is_key_vault_refresh_failed = Some(is_key_vault_refresh_failed); + 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/{}/notifications", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -14147,12 +22496,19 @@ pub mod notification { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + 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()); } + if let Some(is_key_vault_refresh_failed) = &self.is_key_vault_refresh_failed { + url.query_pairs_mut() + .append_pair("isKeyVaultRefreshFailed", &is_key_vault_refresh_failed.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)?; @@ -14161,7 +22517,7 @@ pub mod notification { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NotificationCollection = + let rsp_value: models::NamedValueCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -14208,19 +22564,19 @@ pub mod notification { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, + pub(crate) named_value_id: String, 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.ApiManagement/service/{}/notifications/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.notification_name + &self.named_value_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -14240,7 +22596,7 @@ pub mod notification { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NotificationContract = + let rsp_value: models::NamedValueContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -14260,6 +22616,12 @@ pub mod notification { } pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Created201(models::NamedValueContract), + Ok200(models::NamedValueContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -14287,7 +22649,8 @@ pub mod notification { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, + pub(crate) named_value_id: String, + pub(crate) parameters: models::NamedValueCreateContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -14296,15 +22659,15 @@ pub mod notification { self.if_match = Some(if_match.into()); self } - 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.ApiManagement/service/{}/notifications/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.notification_name + &self.named_value_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -14316,164 +22679,28 @@ pub mod notification { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NotificationContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::CREATED => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ErrorResponse = + let rsp_value: models::NamedValueContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) + Ok(Response::Created201(rsp_value)) } - } - }) - } - } - } -} -pub mod notification_recipient_user { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_notification( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - subscription_id: impl Into, - ) -> list_by_notification::Builder { - list_by_notification::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - notification_name: notification_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - user_id: 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(), - notification_name: notification_name.into(), - user_id: user_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - user_id: 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(), - notification_name: notification_name.into(), - user_id: user_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn check_entity_exists( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - user_id: impl Into, - subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - notification_name: notification_name.into(), - user_id: user_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_notification { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) notification_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.ApiManagement/service/{}/notifications/{}/recipientUsers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientUserCollection = + let rsp_value: models::NamedValueContract = 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)?; @@ -14489,12 +22716,12 @@ pub mod notification_recipient_user { } } } - pub mod create_or_update { + pub mod update { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::RecipientUserContract), - Ok200(models::RecipientUserContract), + Accepted202, + Ok200(models::NamedValueContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14523,17 +22750,25 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) user_id: String, + pub(crate) named_value_id: String, + pub(crate) parameters: models::NamedValueUpdateParameters, + 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/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14541,21 +22776,18 @@ pub mod notification_recipient_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::RecipientUserContract = - 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), http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientUserContract = + let rsp_value: models::NamedValueContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -14607,14 +22839,21 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) user_id: String, + pub(crate) named_value_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/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_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); @@ -14625,6 +22864,7 @@ pub mod notification_recipient_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + 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)?; @@ -14647,12 +22887,10 @@ pub mod notification_recipient_user { } } } - pub mod check_entity_exists { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Error response #response_type")] - NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -14678,14 +22916,20 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) user_id: String, + pub(crate) named_value_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/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_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); @@ -14702,8 +22946,7 @@ pub mod notification_recipient_user { let 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(()), - http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + 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 = @@ -14718,79 +22961,7 @@ pub mod notification_recipient_user { } } } -} -pub mod notification_recipient_email { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_notification( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - subscription_id: impl Into, - ) -> list_by_notification::Builder { - list_by_notification::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - notification_name: notification_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - email: 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(), - notification_name: notification_name.into(), - email: email.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - email: 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(), - notification_name: notification_name.into(), - email: email.into(), - subscription_id: subscription_id.into(), - } - } - pub fn check_entity_exists( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - email: impl Into, - subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - notification_name: notification_name.into(), - email: email.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_notification { + pub mod list_value { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14819,16 +22990,23 @@ pub mod notification_recipient_email { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, + pub(crate) named_value_id: String, 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.ApiManagement/service/{}/notifications/{}/recipientEmails" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}/listValue", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14837,6 +23015,7 @@ pub mod notification_recipient_email { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); 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)?; @@ -14844,7 +23023,7 @@ pub mod notification_recipient_email { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientEmailCollection = + let rsp_value: models::NamedValueSecretContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -14862,12 +23041,12 @@ pub mod notification_recipient_email { } } } - pub mod create_or_update { + pub mod refresh_secret { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::RecipientEmailContract), - Ok200(models::RecipientEmailContract), + Accepted202, + Ok200(models::NamedValueContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14896,17 +23075,23 @@ pub mod notification_recipient_email { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) email: String, + pub(crate) named_value_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/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}/refreshSecret", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14915,20 +23100,16 @@ pub mod notification_recipient_email { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientEmailContract = - 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), http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientEmailContract = + let rsp_value: models::NamedValueContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -14946,13 +23127,42 @@ pub mod notification_recipient_email { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, +} +pub mod network_status { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> list_by_service::Builder { + list_by_service::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_by_location( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + location_name: impl Into, + ) -> list_by_location::Builder { + list_by_location::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + location_name: location_name.into(), + } } + } + pub mod list_by_service { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -14978,19 +23188,25 @@ pub mod notification_recipient_email { #[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) notification_name: String, - pub(crate) email: String, - 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, Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/networkstatus", + 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15004,8 +23220,12 @@ pub mod notification_recipient_email { let rsp = 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::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::ErrorResponse = @@ -15020,12 +23240,10 @@ pub mod notification_recipient_email { } } } - pub mod check_entity_exists { + pub mod list_by_location { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Error response #response_type")] - NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -15049,19 +23267,25 @@ pub mod notification_recipient_email { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) email: String, pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) location_name: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/locations/{}/networkstatus", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.location_name + ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15075,8 +23299,12 @@ pub mod notification_recipient_email { let 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(()), - http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkStatusContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -15092,7 +23320,7 @@ pub mod notification_recipient_email { } } } -pub mod open_id_connect_provider { +pub mod notification { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -15107,7 +23335,6 @@ pub mod open_id_connect_provider { resource_group_name: resource_group_name.into(), service_name: service_name.into(), subscription_id: subscription_id.into(), - filter: None, top: None, skip: None, } @@ -15116,14 +23343,14 @@ pub mod open_id_connect_provider { &self, resource_group_name: impl Into, service_name: impl Into, - opid: impl Into, + notification_name: 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(), - opid: opid.into(), + notification_name: notification_name.into(), subscription_id: subscription_id.into(), } } @@ -15131,86 +23358,18 @@ pub mod open_id_connect_provider { &self, resource_group_name: impl Into, service_name: impl Into, - opid: impl Into, - parameters: impl Into, + notification_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(), service_name: service_name.into(), - opid: opid.into(), - parameters: parameters.into(), + notification_name: notification_name.into(), subscription_id: subscription_id.into(), if_match: None, } } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - opid: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - opid: opid.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - opid: 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(), - opid: opid.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, - opid: 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(), - opid: opid.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_secrets( - &self, - resource_group_name: impl Into, - service_name: impl Into, - opid: impl Into, - subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - opid: opid.into(), - subscription_id: subscription_id.into(), - } - } } pub mod list_by_service { use super::models; @@ -15242,15 +23401,10 @@ pub mod open_id_connect_provider { 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 @@ -15259,12 +23413,10 @@ pub mod open_id_connect_provider { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/openidConnectProviders", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -15280,9 +23432,6 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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()); } @@ -15297,7 +23446,7 @@ pub mod open_id_connect_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OpenIdConnectProviderCollection = + let rsp_value: models::NotificationCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -15344,21 +23493,19 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, + pub(crate) notification_name: String, 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.ApiManagement/service/{}/openidConnectProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.opid + &self.notification_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -15378,7 +23525,7 @@ pub mod open_id_connect_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OpenidConnectProviderContract = + let rsp_value: models::NotificationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -15398,11 +23545,6 @@ pub mod open_id_connect_provider { } pub mod create_or_update { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::OpenidConnectProviderContract), - Ok200(models::OpenidConnectProviderContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15430,8 +23572,7 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, - pub(crate) parameters: models::OpenidConnectProviderContract, + pub(crate) notification_name: String, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -15440,15 +23581,15 @@ pub mod open_id_connect_provider { self.if_match = Some(if_match.into()); self } - 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.ApiManagement/service/{}/openidConnectProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.opid + &self.notification_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -15460,27 +23601,20 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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); } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::OpenidConnectProviderContract = - 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::OpenidConnectProviderContract = + let rsp_value: models::NotificationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -15496,7 +23630,79 @@ pub mod open_id_connect_provider { } } } - pub mod update { +} +pub mod notification_recipient_user { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_notification( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + subscription_id: impl Into, + ) -> list_by_notification::Builder { + list_by_notification::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + user_id: 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(), + notification_name: notification_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + user_id: 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(), + notification_name: notification_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_notification { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -15525,27 +23731,16 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, - pub(crate) parameters: models::OpenidConnectProviderUpdateContract, - pub(crate) if_match: String, + pub(crate) notification_name: String, 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.ApiManagement/service/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15553,9 +23748,7 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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.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)?; @@ -15563,7 +23756,7 @@ pub mod open_id_connect_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OpenidConnectProviderContract = + let rsp_value: models::RecipientUserCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -15581,12 +23774,12 @@ pub mod open_id_connect_provider { } } } - pub mod delete { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200, - NoContent204, + Created201(models::RecipientUserContract), + Ok200(models::RecipientUserContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -15615,24 +23808,17 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, - pub(crate) if_match: String, + pub(crate) notification_name: String, + pub(crate) user_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/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15640,15 +23826,24 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecipientUserContract = + 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::RecipientUserContract = + 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 = @@ -15663,8 +23858,13 @@ pub mod open_id_connect_provider { } } } - pub mod get_entity_tag { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15692,23 +23892,17 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, + pub(crate) notification_name: String, + pub(crate) user_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15722,7 +23916,8 @@ pub mod open_id_connect_provider { let rsp = 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(()), + 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 = @@ -15737,10 +23932,12 @@ pub mod open_id_connect_provider { } } } - pub mod list_secrets { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -15766,16 +23963,17 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, + pub(crate) notification_name: String, + pub(crate) user_id: String, 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<(), Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . opid) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15784,18 +23982,13 @@ pub mod open_id_connect_provider { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); 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::ClientSecretContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + http::StatusCode::NO_CONTENT => Ok(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -15811,91 +24004,78 @@ pub mod open_id_connect_provider { } } } -pub mod policy { +pub mod notification_recipient_email { use super::models; 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(), - } - } - pub fn get( + pub fn list_by_notification( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, + notification_name: impl Into, subscription_id: impl Into, - ) -> get::Builder { - get::Builder { + ) -> list_by_notification::Builder { + list_by_notification::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - policy_id: policy_id.into(), + notification_name: notification_name.into(), subscription_id: subscription_id.into(), - format: None, } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, - parameters: impl Into, + notification_name: impl Into, + email: 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(), - policy_id: policy_id.into(), - parameters: parameters.into(), + notification_name: notification_name.into(), + email: email.into(), subscription_id: subscription_id.into(), - if_match: None, } } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, - if_match: impl Into, + notification_name: impl Into, + email: 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(), - policy_id: policy_id.into(), - if_match: if_match.into(), + notification_name: notification_name.into(), + email: email.into(), subscription_id: subscription_id.into(), } } - pub fn get_entity_tag( + pub fn check_entity_exists( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, + notification_name: impl Into, + email: impl Into, subscription_id: impl Into, - ) -> get_entity_tag::Builder { - get_entity_tag::Builder { + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - policy_id: policy_id.into(), + notification_name: notification_name.into(), + email: email.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_service { + pub mod list_by_notification { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -15924,18 +24104,13 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) notification_name: String, 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.ApiManagement/service/{}/policies", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::GET); @@ -15954,7 +24129,7 @@ pub mod policy { match 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 = + let rsp_value: models::RecipientEmailCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -15972,8 +24147,13 @@ pub mod policy { } } } - pub mod get { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::RecipientEmailContract), + Ok200(models::RecipientEmailContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -16001,28 +24181,101 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, + pub(crate) notification_name: String, + pub(crate) email: String, pub(crate) subscription_id: String, - pub(crate) format: Option, } impl Builder { - pub fn format(mut self, format: impl Into) -> Self { - self.format = Some(format.into()); - self - } - 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.ApiManagement/service/{}/policies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.policy_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let mut url = 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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::RecipientEmailContract = + 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::RecipientEmailContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) notification_name: String, + pub(crate) email: 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/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16030,21 +24283,14 @@ pub mod policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - if let Some(format) = &self.format { - url.query_pairs_mut().append_pair("format", format); - } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PolicyContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -16059,15 +24305,12 @@ pub mod policy { } } } - pub mod create_or_update { + pub mod check_entity_exists { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::PolicyContract), - Ok200(models::PolicyContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -16093,29 +24336,17 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, - pub(crate) parameters: models::PolicyContract, + pub(crate) notification_name: String, + pub(crate) email: String, 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> { + 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/{}/policies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.policy_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; let mut url = 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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16123,28 +24354,14 @@ pub mod policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::PolicyContract = - 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::PolicyContract = - 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(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -16159,13 +24376,129 @@ pub mod policy { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, +} +pub mod open_id_connect_provider { + use super::models; + 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, + opid: 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(), + opid: opid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: 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(), + opid: opid.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + opid: opid.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: 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(), + opid: opid.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, + opid: 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(), + opid: opid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + opid: opid.into(), + subscription_id: subscription_id.into(), + } } + } + pub mod list_by_service { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -16193,24 +24526,38 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, - pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.policy_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16218,15 +24565,27 @@ pub mod policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - req_builder = req_builder.header("If-Match", &self.if_match); + 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 => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenIdConnectProviderCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -16241,7 +24600,7 @@ pub mod policy { } } } - pub mod get_entity_tag { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -16270,23 +24629,25 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, + pub(crate) opid: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.policy_id + &self.opid ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16300,7 +24661,12 @@ pub mod policy { let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenidConnectProviderContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -16315,28 +24681,13 @@ pub mod policy { } } } -} -pub mod policy_description { - use super::models; - 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(), - scope: None, - } - } - } - pub mod list_by_service { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::OpenidConnectProviderContract), + Ok200(models::OpenidConnectProviderContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -16364,28 +24715,29 @@ pub mod policy_description { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) opid: String, + pub(crate) parameters: models::OpenidConnectProviderContract, pub(crate) subscription_id: String, - pub(crate) scope: Option, + pub(crate) if_match: Option, } impl Builder { - pub fn scope(mut self, scope: impl Into) -> Self { - self.scope = Some(scope.into()); + 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> { + 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/{}/policyDescriptions", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.opid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16393,20 +24745,27 @@ pub mod policy_description { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - if let Some(scope) = &self.scope { - url.query_pairs_mut().append_pair("scope", scope); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::OpenidConnectProviderContract = + 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::PolicyDescriptionCollection = + let rsp_value: models::OpenidConnectProviderContract = 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)?; @@ -16422,95 +24781,7 @@ pub mod policy_description { } } } -} -pub mod portal_revision { - use super::models; - 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, - portal_revision_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(), - portal_revision_id: portal_revision_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - portal_revision_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(), - portal_revision_id: portal_revision_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - portal_revision_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - portal_revision_id: portal_revision_id.into(), - parameters: parameters.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, - portal_revision_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(), - portal_revision_id: portal_revision_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -16539,36 +24810,27 @@ pub mod portal_revision { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) opid: String, + pub(crate) parameters: models::OpenidConnectProviderUpdateContract, + pub(crate) if_match: 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> { + 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/{}/portalRevisions", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.opid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16576,16 +24838,9 @@ pub mod portal_revision { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.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)?; @@ -16593,7 +24848,7 @@ pub mod portal_revision { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalRevisionCollection = + let rsp_value: models::OpenidConnectProviderContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -16611,8 +24866,13 @@ pub mod portal_revision { } } } - pub mod get { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -16640,23 +24900,24 @@ pub mod portal_revision { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) portal_revision_id: String, + pub(crate) opid: 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> { + 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/{}/portalRevisions/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.portal_revision_id + &self.opid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16664,18 +24925,15 @@ pub mod portal_revision { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalRevisionContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -16690,13 +24948,8 @@ pub mod portal_revision { } } } - pub mod create_or_update { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Created201(models::PortalRevisionContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -16724,45 +24977,37 @@ pub mod portal_revision { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) portal_revision_id: String, - pub(crate) parameters: models::PortalRevisionContract, + pub(crate) opid: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.portal_revision_id + &self.opid ); let mut url = 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); + 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", "2020-12-01"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalRevisionContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Created201(rsp_value)) - } + 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 = @@ -16777,13 +25022,8 @@ pub mod portal_revision { } } } - pub mod update { + pub mod list_secrets { use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Ok200(models::PortalRevisionContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -16811,25 +25051,16 @@ pub mod portal_revision { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) portal_revision_id: String, - pub(crate) parameters: models::PortalRevisionContract, - pub(crate) if_match: String, + pub(crate) opid: String, 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.ApiManagement/service/{}/portalRevisions/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.portal_revision_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . opid) ; let mut url = 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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16837,20 +25068,18 @@ pub mod portal_revision { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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.header("If-Match", &self.if_match); + 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::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalRevisionContract = + let rsp_value: models::ClientSecretContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -16866,7 +25095,92 @@ pub mod portal_revision { } } } - pub mod get_entity_tag { +} +pub mod policy { + use super::models; + 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(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + policy_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(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + format: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + policy_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(), + policy_id: policy_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, + policy_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(), + policy_id: policy_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, + policy_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(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -16895,23 +25209,21 @@ pub mod portal_revision { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) portal_revision_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/portalRevisions/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.portal_revision_id + &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::HEAD); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16925,7 +25237,12 @@ pub mod portal_revision { let rsp = 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(()), + 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)?; let rsp_value: models::ErrorResponse = @@ -16940,26 +25257,7 @@ pub mod portal_revision { } } } -} -pub mod portal_settings { - use super::models; - 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(), - } - } - } - pub mod list_by_service { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -16988,17 +25286,24 @@ pub mod portal_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) policy_id: String, pub(crate) subscription_id: String, + pub(crate) format: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.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/{}/portalsettings", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -17010,6 +25315,9 @@ pub mod portal_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -17018,7 +25326,7 @@ pub mod portal_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSettingsCollection = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -17036,73 +25344,13 @@ pub mod portal_settings { } } } -} -pub mod sign_in_settings { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - resource_group_name: impl Into, - service_name: 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(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - 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(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - parameters: parameters.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, - 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(), - subscription_id: subscription_id.into(), - } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), } - } - pub mod get { - use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -17130,21 +25378,29 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17152,17 +25408,27 @@ pub mod sign_in_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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::PolicyContract = + 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::PortalSigninSettings = + let rsp_value: models::PolicyContract = 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)?; @@ -17178,8 +25444,13 @@ pub mod sign_in_settings { } } } - pub mod create_or_update { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -17207,27 +25478,24 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSigninSettings, + pub(crate) policy_id: String, + pub(crate) if_match: String, 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> { + 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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17235,22 +25503,15 @@ pub mod sign_in_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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.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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSigninSettings = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -17265,7 +25526,7 @@ pub mod sign_in_settings { } } } - pub mod update { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17294,23 +25555,23 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSigninSettings, - pub(crate) if_match: String, + pub(crate) policy_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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17318,15 +25579,13 @@ pub mod sign_in_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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.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::NO_CONTENT => Ok(()), + 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 = @@ -17341,7 +25600,27 @@ pub mod sign_in_settings { } } } - pub mod get_entity_tag { +} +pub mod policy_description { + use super::models; + 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(), + scope: None, + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17371,12 +25650,19 @@ pub mod sign_in_settings { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) subscription_id: String, + pub(crate) scope: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + pub fn scope(mut self, scope: impl Into) -> Self { + self.scope = Some(scope.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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policyDescriptions", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -17384,7 +25670,7 @@ pub mod sign_in_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17392,13 +25678,21 @@ pub mod sign_in_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + if let Some(scope) = &self.scope { + url.query_pairs_mut().append_pair("scope", scope); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyDescriptionCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -17414,20 +25708,38 @@ pub mod sign_in_settings { } } } -pub mod sign_up_settings { +pub mod portal_revision { use super::models; 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, + portal_revision_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(), + portal_revision_id: portal_revision_id.into(), subscription_id: subscription_id.into(), } } @@ -17435,23 +25747,25 @@ pub mod sign_up_settings { &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + portal_revision_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(), + portal_revision_id: portal_revision_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), - if_match: None, } } pub fn update( &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + portal_revision_id: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -17459,6 +25773,7 @@ pub mod sign_up_settings { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + portal_revision_id: portal_revision_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), @@ -17468,16 +25783,119 @@ pub mod sign_up_settings { &self, resource_group_name: impl Into, service_name: impl Into, + portal_revision_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(), + portal_revision_id: portal_revision_id.into(), subscription_id: subscription_id.into(), } } } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/portalRevisions", + 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", "2020-12-01"); + 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::PortalRevisionCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; #[derive(Debug, thiserror :: Error)] @@ -17507,17 +25925,19 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) portal_revision_id: String, 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.ApiManagement/service/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.portal_revision_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -17537,7 +25957,7 @@ pub mod sign_up_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSignupSettings = + let rsp_value: models::PortalRevisionContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -17557,6 +25977,11 @@ pub mod sign_up_settings { } pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Created201(models::PortalRevisionContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -17584,23 +26009,20 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSignupSettings, + pub(crate) portal_revision_id: String, + pub(crate) parameters: models::PortalRevisionContract, 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> { + 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/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.portal_revision_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -17614,19 +26036,17 @@ pub mod sign_up_settings { url.query_pairs_mut().append_pair("api-version", "2020-12-01"); 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::OK => { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::CREATED => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSignupSettings = + let rsp_value: models::PortalRevisionContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + Ok(Response::Created201(rsp_value)) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -17644,6 +26064,11 @@ pub mod sign_up_settings { } pub mod update { use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::PortalRevisionContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -17671,19 +26096,21 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSignupSettings, + pub(crate) portal_revision_id: String, + pub(crate) parameters: models::PortalRevisionContract, pub(crate) if_match: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.portal_revision_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -17703,7 +26130,13 @@ pub mod sign_up_settings { let 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(()), + 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::PortalRevisionContract = + 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 = @@ -17747,17 +26180,19 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) portal_revision_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/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.portal_revision_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -17791,76 +26226,17 @@ pub mod sign_up_settings { } } } -pub mod delegation_settings { +pub mod portal_settings { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn get( - &self, - resource_group_name: impl Into, - service_name: 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(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - 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(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - parameters: parameters.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, - 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(), - subscription_id: subscription_id.into(), - } - } - pub fn list_secrets( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), @@ -17868,7 +26244,7 @@ pub mod delegation_settings { } } } - pub mod get { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17900,10 +26276,10 @@ pub mod delegation_settings { 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.ApiManagement/service/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -17927,7 +26303,7 @@ pub mod delegation_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalDelegationSettings = + let rsp_value: models::PortalSettingsCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -17945,7 +26321,72 @@ pub mod delegation_settings { } } } - pub mod create_or_update { +} +pub mod sign_in_settings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + service_name: 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(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + 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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.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, + 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(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17974,19 +26415,13 @@ pub mod delegation_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalDelegationSettings, 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> { + 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/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -17994,7 +26429,7 @@ pub mod delegation_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18002,11 +26437,7 @@ pub mod delegation_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -18014,7 +26445,7 @@ pub mod delegation_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalDelegationSettings = + let rsp_value: models::PortalSigninSettings = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -18032,7 +26463,7 @@ pub mod delegation_settings { } } } - pub mod update { + pub mod create_or_update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18061,15 +26492,19 @@ pub mod delegation_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalDelegationSettings, - pub(crate) if_match: String, + pub(crate) parameters: models::PortalSigninSettings, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -18077,7 +26512,7 @@ pub mod delegation_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18087,13 +26522,20 @@ pub mod delegation_settings { url.query_pairs_mut().append_pair("api-version", "2020-12-01"); 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.header("If-Match", &self.if_match); + 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::NO_CONTENT => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalSigninSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -18108,7 +26550,7 @@ pub mod delegation_settings { } } } - pub mod get_entity_tag { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18137,13 +26579,15 @@ pub mod delegation_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) parameters: models::PortalSigninSettings, + pub(crate) if_match: 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/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -18151,7 +26595,7 @@ pub mod delegation_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18159,13 +26603,15 @@ pub mod delegation_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => Ok(()), + 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::ErrorResponse = @@ -18180,7 +26626,7 @@ pub mod delegation_settings { } } } - pub mod list_secrets { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18212,14 +26658,18 @@ pub mod delegation_settings { 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<(), Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", + 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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18228,18 +26678,12 @@ pub mod delegation_settings { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); 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::PortalSettingValidationKeyContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -18255,40 +26699,20 @@ pub mod delegation_settings { } } } -pub mod product { +pub mod sign_up_settings { use super::models; 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, - expand_groups: None, - tags: None, - } - } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - product_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(), - product_id: product_id.into(), subscription_id: subscription_id.into(), } } @@ -18296,15 +26720,13 @@ pub mod product { &self, resource_group_name: impl Into, service_name: impl Into, - product_id: impl Into, - parameters: 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(), - product_id: product_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -18314,8 +26736,7 @@ pub mod product { &self, resource_group_name: impl Into, service_name: impl Into, - product_id: impl Into, - parameters: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -18323,64 +26744,190 @@ pub mod product { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - product_id: product_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_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(), - product_id: product_id.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - delete_subscriptions: None, - } - } pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, - product_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(), - product_id: product_id.into(), subscription_id: subscription_id.into(), } } - pub fn list_by_tags( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> list_by_tags::Builder { - list_by_tags::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, - include_not_tagged_products: None, + } + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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, + } + impl Builder { + 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/{}/portalsettings/signup", + 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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalSignupSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) parameters: models::PortalSignupSettings, + 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/{}/portalsettings/signup", + 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", "2020-12-01"); + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalSignupSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_service { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18409,38 +26956,15 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) parameters: models::PortalSignupSettings, + pub(crate) if_match: String, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, - pub(crate) expand_groups: Option, - pub(crate) tags: 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 expand_groups(mut self, expand_groups: bool) -> Self { - self.expand_groups = Some(expand_groups); - self - } - pub fn tags(mut self, tags: impl Into) -> Self { - self.tags = Some(tags.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/products", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -18448,7 +26972,7 @@ pub mod product { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18456,33 +26980,15 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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()); - } - if let Some(expand_groups) = &self.expand_groups { - url.query_pairs_mut().append_pair("expandGroups", &expand_groups.to_string()); - } - if let Some(tags) = &self.tags { - url.query_pairs_mut().append_pair("tags", tags); - } - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProductCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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::ErrorResponse = @@ -18497,7 +27003,7 @@ pub mod product { } } } - pub mod get { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18526,23 +27032,21 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18556,12 +27060,7 @@ pub mod product { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProductContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -18576,13 +27075,86 @@ pub mod product { } } } - pub mod create_or_update { - use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ProductContract), - Ok200(models::ProductContract), +} +pub mod delegation_settings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + service_name: 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(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + 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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.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, + 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(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -18610,29 +27182,21 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) parameters: models::ProductContract, 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> { + 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18640,27 +27204,17 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ProductContract = - 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::ProductContract = + let rsp_value: models::PortalDelegationSettings = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -18676,7 +27230,7 @@ pub mod product { } } } - pub mod update { + pub mod create_or_update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18705,25 +27259,27 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) parameters: models::ProductUpdateParameters, - pub(crate) if_match: String, + pub(crate) parameters: models::PortalDelegationSettings, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18733,7 +27289,9 @@ pub mod product { url.query_pairs_mut().append_pair("api-version", "2020-12-01"); 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.header("If-Match", &self.if_match); + 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)?; @@ -18741,7 +27299,7 @@ pub mod product { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProductContract = + let rsp_value: models::PortalDelegationSettings = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -18759,13 +27317,8 @@ pub mod product { } } } - pub mod delete { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -18793,29 +27346,23 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, + pub(crate) parameters: models::PortalDelegationSettings, pub(crate) if_match: String, pub(crate) subscription_id: String, - pub(crate) delete_subscriptions: Option, } impl Builder { - pub fn delete_subscriptions(mut self, delete_subscriptions: bool) -> Self { - self.delete_subscriptions = Some(delete_subscriptions); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18823,19 +27370,15 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + 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.header("If-Match", &self.if_match); - if let Some(delete_subscriptions) = &self.delete_subscriptions { - url.query_pairs_mut() - .append_pair("deleteSubscriptions", &delete_subscriptions.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::NO_CONTENT => Ok(Response::NoContent204), + 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::ErrorResponse = @@ -18879,19 +27422,17 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &self.service_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -18924,7 +27465,7 @@ pub mod product { } } } - pub mod list_by_tags { + pub mod list_secrets { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18954,40 +27495,16 @@ pub mod product { 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, - pub(crate) include_not_tagged_products: 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 include_not_tagged_products(mut self, include_not_tagged_products: bool) -> Self { - self.include_not_tagged_products = Some(include_not_tagged_products); - self - } - 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.ApiManagement/service/{}/productsByTags", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation/listSecrets" , 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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18995,20 +27512,8 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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()); - } - if let Some(include_not_tagged_products) = &self.include_not_tagged_products { - url.query_pairs_mut() - .append_pair("includeNotTaggedProducts", &include_not_tagged_products.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)?; @@ -19016,7 +27521,7 @@ pub mod product { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagResourceCollection = + let rsp_value: models::PortalSettingValidationKeyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -19035,26 +27540,41 @@ pub mod product { } } } -pub mod product_api { +pub mod product { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_product( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - product_id: impl Into, subscription_id: impl Into, - ) -> list_by_product::Builder { - list_by_product::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - product_id: product_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, + expand_groups: None, + tags: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_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(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), } } pub fn create_or_update( @@ -19062,7 +27582,7 @@ pub mod product_api { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - api_id: impl Into, + parameters: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -19070,7 +27590,27 @@ pub mod product_api { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - api_id: api_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } @@ -19079,7 +27619,7 @@ pub mod product_api { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - api_id: impl Into, + if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { delete::Builder { @@ -19087,138 +27627,46 @@ pub mod product_api { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - api_id: api_id.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), + delete_subscriptions: None, } } - pub fn check_entity_exists( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - api_id: impl Into, subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - api_id: api_id.into(), subscription_id: subscription_id.into(), } } - } - pub mod list_by_product { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: 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/{}/products/{}/apis", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_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", "2020-12-01"); - 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::ApiCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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 list_by_tags( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_tags::Builder { + list_by_tags::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, + include_not_tagged_products: None, } } } - pub mod create_or_update { + pub mod list_by_service { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ApiContract), - Ok200(models::ApiContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -19246,25 +27694,46 @@ pub mod product_api { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) api_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) expand_groups: Option, + pub(crate) tags: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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 expand_groups(mut self, expand_groups: bool) -> Self { + self.expand_groups = Some(expand_groups); + self + } + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.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/{}/products/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.api_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -19272,106 +27741,33 @@ pub mod product_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + 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()); + } + if let Some(expand_groups) = &self.expand_groups { + url.query_pairs_mut().append_pair("expandGroups", &expand_groups.to_string()); + } + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ApiContract = - 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::ApiContract = - 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 = + let rsp_value: models::ProductCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) + Ok(rsp_value) } - } - }) - } - } - } - pub mod delete { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: String, - pub(crate) api_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/{}/products/{}/apis/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.api_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", "2020-12-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = 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 = @@ -19386,7 +27782,7 @@ pub mod product_api { } } } - pub mod check_entity_exists { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -19416,24 +27812,22 @@ pub mod product_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) api_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/products/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.api_id + &self.product_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -19447,98 +27841,33 @@ pub mod product_api { let 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 => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ErrorResponse = + let rsp_value: models::ProductContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) + Ok(rsp_value) } - } - }) - } - } - } -} -pub mod product_group { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - subscription_id: impl Into, - ) -> list_by_product::Builder { - list_by_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - group_id: 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(), - product_id: product_id.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - group_id: 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(), - product_id: product_id.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn check_entity_exists( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - group_id: impl Into, - subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), + 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_product { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ProductContract), + Ok200(models::ProductContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -19567,28 +27896,19 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, + pub(crate) parameters: models::ProductContract, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, + pub(crate) if_match: 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); + 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> { + 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/{}/products/{}/groups", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -19597,7 +27917,7 @@ pub mod product_group { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -19605,26 +27925,27 @@ pub mod product_group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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()); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ProductContract = + 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::GroupCollection = + let rsp_value: models::ProductContract = 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)?; @@ -19640,13 +27961,8 @@ pub mod product_group { } } } - pub mod create_or_update { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::GroupContract), - Ok200(models::GroupContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -19675,24 +27991,24 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) group_id: String, + pub(crate) parameters: models::ProductUpdateParameters, + pub(crate) if_match: String, 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.ApiManagement/service/{}/products/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.group_id + &self.product_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -19700,23 +28016,19 @@ pub mod product_group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::GroupContract = - 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::GroupContract = + let rsp_value: models::ProductContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -19767,20 +28079,24 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) group_id: String, + pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) delete_subscriptions: Option, } impl Builder { + pub fn delete_subscriptions(mut self, delete_subscriptions: bool) -> Self { + self.delete_subscriptions = Some(delete_subscriptions); + 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/{}/products/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.group_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -19792,6 +28108,11 @@ pub mod product_group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + req_builder = req_builder.header("If-Match", &self.if_match); + if let Some(delete_subscriptions) = &self.delete_subscriptions { + url.query_pairs_mut() + .append_pair("deleteSubscriptions", &delete_subscriptions.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)?; @@ -19814,7 +28135,7 @@ pub mod product_group { } } } - pub mod check_entity_exists { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -19844,20 +28165,18 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) group_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/{}/products/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.group_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -19875,7 +28194,7 @@ pub mod product_group { let 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(()), + 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 = @@ -19890,31 +28209,7 @@ pub mod product_group { } } } -} -pub mod product_subscriptions { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - } - pub mod list { + pub mod list_by_tags { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -19943,11 +28238,11 @@ pub mod product_subscriptions { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, + pub(crate) include_not_tagged_products: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -19962,15 +28257,18 @@ pub mod product_subscriptions { self.skip = Some(skip); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn include_not_tagged_products(mut self, include_not_tagged_products: bool) -> Self { + self.include_not_tagged_products = Some(include_not_tagged_products); + 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/{}/products/{}/subscriptions", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/productsByTags", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &self.service_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -19991,6 +28289,10 @@ pub mod product_subscriptions { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } + if let Some(include_not_tagged_products) = &self.include_not_tagged_products { + url.query_pairs_mut() + .append_pair("includeNotTaggedProducts", &include_not_tagged_products.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)?; @@ -19999,7 +28301,7 @@ pub mod product_subscriptions { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::SubscriptionCollection = + let rsp_value: models::TagResourceCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -20018,7 +28320,7 @@ pub mod product_subscriptions { } } } -pub mod product_policy { +pub mod product_api { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -20035,24 +28337,9 @@ pub mod product_policy { service_name: service_name.into(), product_id: product_id.into(), subscription_id: subscription_id.into(), - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - policy_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(), - product_id: product_id.into(), - policy_id: policy_id.into(), - subscription_id: subscription_id.into(), - format: None, + filter: None, + top: None, + skip: None, } } pub fn create_or_update( @@ -20060,8 +28347,7 @@ pub mod product_policy { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - policy_id: impl Into, - parameters: impl Into, + api_id: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -20069,10 +28355,8 @@ pub mod product_policy { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - policy_id: policy_id.into(), - parameters: parameters.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), - if_match: None, } } pub fn delete( @@ -20080,8 +28364,7 @@ pub mod product_policy { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - policy_id: impl Into, - if_match: impl Into, + api_id: impl Into, subscription_id: impl Into, ) -> delete::Builder { delete::Builder { @@ -20089,109 +28372,29 @@ pub mod product_policy { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - policy_id: policy_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, - product_id: impl Into, - policy_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(), - product_id: product_id.into(), - policy_id: policy_id.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_product { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_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/{}/products/{}/policies", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_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", "2020-12-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match 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)?; - 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 check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), } } } - pub mod get { + pub mod list_by_product { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -20221,25 +28424,33 @@ pub mod product_policy { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) policy_id: String, pub(crate) subscription_id: String, - pub(crate) format: Option, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn format(mut self, format: impl Into) -> Self { - self.format = Some(format.into()); + 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> { + 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/{}/products/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.policy_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -20251,8 +28462,14 @@ pub mod product_policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - if let Some(format) = &self.format { - url.query_pairs_mut().append_pair("format", format); + 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()); @@ -20262,7 +28479,7 @@ pub mod product_policy { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PolicyContract = + let rsp_value: models::ApiCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -20284,8 +28501,8 @@ pub mod product_policy { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::PolicyContract), - Ok200(models::PolicyContract), + Created201(models::ApiContract), + Ok200(models::ApiContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -20315,26 +28532,20 @@ pub mod product_policy { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) policy_id: String, - pub(crate) parameters: models::PolicyContract, + pub(crate) api_id: String, 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/{}/products/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.policy_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -20346,11 +28557,7 @@ pub mod product_policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - if let Some(if_match) = &self.if_match { - req_builder = req_builder.header("If-Match", if_match); - } - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -20358,13 +28565,13 @@ pub mod product_policy { 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::PolicyContract = + let rsp_value: models::ApiContract = 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::PolicyContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -20417,21 +28624,20 @@ pub mod product_policy { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) policy_id: String, - pub(crate) if_match: String, + pub(crate) api_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/{}/products/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.policy_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -20443,7 +28649,6 @@ pub mod product_policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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)?; @@ -20466,7 +28671,7 @@ pub mod product_policy { } } } - pub mod get_entity_tag { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -20492,213 +28697,93 @@ pub mod product_policy { } #[derive(Clone)] pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) policy_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/{}/products/{}/policies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.policy_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", "2020-12-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = 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 tag { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - subscription_id: impl Into, - ) -> list_by_product::Builder { - list_by_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - pub fn get_by_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - tag_id: impl Into, - subscription_id: impl Into, - ) -> get_by_product::Builder { - get_by_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn assign_to_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - tag_id: impl Into, - subscription_id: impl Into, - ) -> assign_to_product::Builder { - assign_to_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn detach_from_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - tag_id: impl Into, - subscription_id: impl Into, - ) -> detach_from_product::Builder { - detach_from_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) api_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/{}/products/{}/apis/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.api_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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::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 get_entity_state_by_product( + } +} +pub mod product_group { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_product( &self, resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - tag_id: impl Into, subscription_id: impl Into, - ) -> get_entity_state_by_product::Builder { - get_entity_state_by_product::Builder { + ) -> list_by_product::Builder { + list_by_product::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), - } - } - 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, - scope: None, - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - tag_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(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - tag_id: impl Into, - parameters: impl Into, + product_id: impl Into, + group_id: 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(), - tag_id: tag_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - tag_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - tag_id: tag_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), + product_id: product_id.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -20706,31 +28791,33 @@ pub mod tag { &self, resource_group_name: impl Into, service_name: impl Into, - tag_id: impl Into, - if_match: impl Into, + product_id: impl Into, + group_id: 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(), - tag_id: tag_id.into(), - if_match: if_match.into(), + product_id: product_id.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } - pub fn get_entity_state( + pub fn check_entity_exists( &self, resource_group_name: impl Into, service_name: impl Into, - tag_id: impl Into, + product_id: impl Into, + group_id: impl Into, subscription_id: impl Into, - ) -> get_entity_state::Builder { - get_entity_state::Builder { + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - tag_id: tag_id.into(), + product_id: product_id.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -20783,10 +28870,10 @@ pub mod tag { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/products/{}/tags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -20820,88 +28907,7 @@ pub mod tag { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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_product { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: String, - pub(crate) tag_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/{}/products/{}/tags/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.tag_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", "2020-12-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagContract = + let rsp_value: models::GroupCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -20919,12 +28925,12 @@ pub mod tag { } } } - pub mod assign_to_product { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::TagContract), - Ok200(models::TagContract), + Created201(models::GroupContract), + Ok200(models::GroupContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -20954,20 +28960,20 @@ pub mod tag { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) tag_id: String, + pub(crate) group_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/{}/products/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.tag_id + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -20987,13 +28993,13 @@ pub mod tag { 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::TagContract = + let rsp_value: models::GroupContract = 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::TagContract = + let rsp_value: models::GroupContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -21011,7 +29017,7 @@ pub mod tag { } } } - pub mod detach_from_product { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { @@ -21046,20 +29052,20 @@ pub mod tag { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) tag_id: String, + pub(crate) group_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/{}/products/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.tag_id + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -21093,7 +29099,7 @@ pub mod tag { } } } - pub mod get_entity_state_by_product { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -21123,20 +29129,20 @@ pub mod tag { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) tag_id: String, + pub(crate) group_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/{}/products/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.tag_id + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -21154,7 +29160,7 @@ pub mod tag { let rsp = 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(()), + 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::ErrorResponse = @@ -21169,7 +29175,31 @@ pub mod tag { } } } - pub mod list_by_service { +} +pub mod product_subscriptions { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -21198,11 +29228,11 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) product_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, - pub(crate) scope: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -21217,18 +29247,15 @@ pub mod tag { self.skip = Some(skip); self } - pub fn scope(mut self, scope: impl Into) -> Self { - self.scope = Some(scope.into()); - self - } - 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.ApiManagement/service/{}/tags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/subscriptions", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -21249,9 +29276,6 @@ pub mod tag { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } - if let Some(scope) = &self.scope { - url.query_pairs_mut().append_pair("scope", scope); - } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -21260,7 +29284,7 @@ pub mod tag { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagCollection = + let rsp_value: models::SubscriptionCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -21278,7 +29302,102 @@ pub mod tag { } } } - pub mod get { +} +pub mod product_policy { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list_by_product::Builder { + list_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + format: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_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, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_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, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_product { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -21307,19 +29426,19 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, + pub(crate) product_id: String, 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.ApiManagement/service/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -21339,7 +29458,7 @@ pub mod tag { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagContract = + let rsp_value: models::PolicyCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -21357,13 +29476,8 @@ pub mod tag { } } } - pub mod create_or_update { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::TagContract), - Ok200(models::TagContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -21391,29 +29505,30 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, - pub(crate) parameters: models::TagCreateUpdateParameters, + pub(crate) product_id: String, + pub(crate) policy_id: String, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) format: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.into()); self } - 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.ApiManagement/service/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -21421,27 +29536,20 @@ pub mod tag { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); - 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); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::TagContract = - 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::TagContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -21457,8 +29565,13 @@ pub mod tag { } } } - pub mod update { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -21486,25 +29599,31 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, - pub(crate) parameters: models::TagCreateUpdateParameters, - pub(crate) if_match: String, + pub(crate) product_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -21512,19 +29631,27 @@ pub mod tag { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } 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.header("If-Match", &self.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::PolicyContract = + 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::TagContract = + let rsp_value: models::PolicyContract = 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)?; @@ -21574,7 +29701,8 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, + pub(crate) product_id: String, + pub(crate) policy_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -21582,12 +29710,13 @@ pub mod tag { 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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -21622,7 +29751,7 @@ pub mod tag { } } } - pub mod get_entity_state { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -21651,19 +29780,21 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, + pub(crate) product_id: String, + pub(crate) policy_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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); diff --git a/services/mgmt/apimanagement/src/package_2021_08/operations.rs b/services/mgmt/apimanagement/src/package_2021_08/operations.rs index 1ed616b807..9fcdcfcb9b 100644 --- a/services/mgmt/apimanagement/src/package_2021_08/operations.rs +++ b/services/mgmt/apimanagement/src/package_2021_08/operations.rs @@ -77,9 +77,21 @@ impl Client { pub fn api(&self) -> api::Client { api::Client(self.clone()) } + pub fn api_diagnostic(&self) -> api_diagnostic::Client { + api_diagnostic::Client(self.clone()) + } pub fn api_export(&self) -> api_export::Client { api_export::Client(self.clone()) } + pub fn api_issue(&self) -> api_issue::Client { + api_issue::Client(self.clone()) + } + pub fn api_issue_attachment(&self) -> api_issue_attachment::Client { + api_issue_attachment::Client(self.clone()) + } + pub fn api_issue_comment(&self) -> api_issue_comment::Client { + api_issue_comment::Client(self.clone()) + } pub fn api_management_operations(&self) -> api_management_operations::Client { api_management_operations::Client(self.clone()) } @@ -92,6 +104,30 @@ impl Client { pub fn api_management_skus(&self) -> api_management_skus::Client { api_management_skus::Client(self.clone()) } + pub fn api_operation(&self) -> api_operation::Client { + api_operation::Client(self.clone()) + } + pub fn api_operation_policy(&self) -> api_operation_policy::Client { + api_operation_policy::Client(self.clone()) + } + pub fn api_policy(&self) -> api_policy::Client { + api_policy::Client(self.clone()) + } + pub fn api_product(&self) -> api_product::Client { + api_product::Client(self.clone()) + } + pub fn api_release(&self) -> api_release::Client { + api_release::Client(self.clone()) + } + pub fn api_revision(&self) -> api_revision::Client { + api_revision::Client(self.clone()) + } + pub fn api_schema(&self) -> api_schema::Client { + api_schema::Client(self.clone()) + } + pub fn api_tag_description(&self) -> api_tag_description::Client { + api_tag_description::Client(self.clone()) + } pub fn api_version_set(&self) -> api_version_set::Client { api_version_set::Client(self.clone()) } @@ -173,6 +209,9 @@ impl Client { pub fn open_id_connect_provider(&self) -> open_id_connect_provider::Client { open_id_connect_provider::Client(self.clone()) } + pub fn operation(&self) -> operation::Client { + operation::Client(self.clone()) + } pub fn outbound_network_dependencies_endpoints(&self) -> outbound_network_dependencies_endpoints::Client { outbound_network_dependencies_endpoints::Client(self.clone()) } @@ -268,6 +307,152 @@ pub enum Error { #[error(transparent)] ApiExport_Get(#[from] api_export::get::Error), #[error(transparent)] + Api_ListByService(#[from] api::list_by_service::Error), + #[error(transparent)] + Api_Get(#[from] api::get::Error), + #[error(transparent)] + Api_CreateOrUpdate(#[from] api::create_or_update::Error), + #[error(transparent)] + Api_Update(#[from] api::update::Error), + #[error(transparent)] + Api_Delete(#[from] api::delete::Error), + #[error(transparent)] + Api_GetEntityTag(#[from] api::get_entity_tag::Error), + #[error(transparent)] + ApiRevision_ListByService(#[from] api_revision::list_by_service::Error), + #[error(transparent)] + ApiRelease_ListByService(#[from] api_release::list_by_service::Error), + #[error(transparent)] + ApiRelease_Get(#[from] api_release::get::Error), + #[error(transparent)] + ApiRelease_CreateOrUpdate(#[from] api_release::create_or_update::Error), + #[error(transparent)] + ApiRelease_Update(#[from] api_release::update::Error), + #[error(transparent)] + ApiRelease_Delete(#[from] api_release::delete::Error), + #[error(transparent)] + ApiRelease_GetEntityTag(#[from] api_release::get_entity_tag::Error), + #[error(transparent)] + ApiOperation_ListByApi(#[from] api_operation::list_by_api::Error), + #[error(transparent)] + ApiOperation_Get(#[from] api_operation::get::Error), + #[error(transparent)] + ApiOperation_CreateOrUpdate(#[from] api_operation::create_or_update::Error), + #[error(transparent)] + ApiOperation_Update(#[from] api_operation::update::Error), + #[error(transparent)] + ApiOperation_Delete(#[from] api_operation::delete::Error), + #[error(transparent)] + ApiOperation_GetEntityTag(#[from] api_operation::get_entity_tag::Error), + #[error(transparent)] + ApiOperationPolicy_ListByOperation(#[from] api_operation_policy::list_by_operation::Error), + #[error(transparent)] + ApiOperationPolicy_Get(#[from] api_operation_policy::get::Error), + #[error(transparent)] + ApiOperationPolicy_CreateOrUpdate(#[from] api_operation_policy::create_or_update::Error), + #[error(transparent)] + ApiOperationPolicy_Delete(#[from] api_operation_policy::delete::Error), + #[error(transparent)] + ApiOperationPolicy_GetEntityTag(#[from] api_operation_policy::get_entity_tag::Error), + #[error(transparent)] + Tag_ListByOperation(#[from] tag::list_by_operation::Error), + #[error(transparent)] + Tag_GetByOperation(#[from] tag::get_by_operation::Error), + #[error(transparent)] + Tag_AssignToOperation(#[from] tag::assign_to_operation::Error), + #[error(transparent)] + Tag_DetachFromOperation(#[from] tag::detach_from_operation::Error), + #[error(transparent)] + Tag_GetEntityStateByOperation(#[from] tag::get_entity_state_by_operation::Error), + #[error(transparent)] + ApiProduct_ListByApis(#[from] api_product::list_by_apis::Error), + #[error(transparent)] + ApiPolicy_ListByApi(#[from] api_policy::list_by_api::Error), + #[error(transparent)] + ApiPolicy_Get(#[from] api_policy::get::Error), + #[error(transparent)] + ApiPolicy_CreateOrUpdate(#[from] api_policy::create_or_update::Error), + #[error(transparent)] + ApiPolicy_Delete(#[from] api_policy::delete::Error), + #[error(transparent)] + ApiPolicy_GetEntityTag(#[from] api_policy::get_entity_tag::Error), + #[error(transparent)] + ApiSchema_ListByApi(#[from] api_schema::list_by_api::Error), + #[error(transparent)] + ApiSchema_Get(#[from] api_schema::get::Error), + #[error(transparent)] + ApiSchema_CreateOrUpdate(#[from] api_schema::create_or_update::Error), + #[error(transparent)] + ApiSchema_Delete(#[from] api_schema::delete::Error), + #[error(transparent)] + ApiSchema_GetEntityTag(#[from] api_schema::get_entity_tag::Error), + #[error(transparent)] + ApiDiagnostic_ListByService(#[from] api_diagnostic::list_by_service::Error), + #[error(transparent)] + ApiDiagnostic_Get(#[from] api_diagnostic::get::Error), + #[error(transparent)] + ApiDiagnostic_CreateOrUpdate(#[from] api_diagnostic::create_or_update::Error), + #[error(transparent)] + ApiDiagnostic_Update(#[from] api_diagnostic::update::Error), + #[error(transparent)] + ApiDiagnostic_Delete(#[from] api_diagnostic::delete::Error), + #[error(transparent)] + ApiDiagnostic_GetEntityTag(#[from] api_diagnostic::get_entity_tag::Error), + #[error(transparent)] + ApiIssue_ListByService(#[from] api_issue::list_by_service::Error), + #[error(transparent)] + ApiIssue_Get(#[from] api_issue::get::Error), + #[error(transparent)] + ApiIssue_CreateOrUpdate(#[from] api_issue::create_or_update::Error), + #[error(transparent)] + ApiIssue_Update(#[from] api_issue::update::Error), + #[error(transparent)] + ApiIssue_Delete(#[from] api_issue::delete::Error), + #[error(transparent)] + ApiIssue_GetEntityTag(#[from] api_issue::get_entity_tag::Error), + #[error(transparent)] + ApiIssueComment_ListByService(#[from] api_issue_comment::list_by_service::Error), + #[error(transparent)] + ApiIssueComment_Get(#[from] api_issue_comment::get::Error), + #[error(transparent)] + ApiIssueComment_CreateOrUpdate(#[from] api_issue_comment::create_or_update::Error), + #[error(transparent)] + ApiIssueComment_Delete(#[from] api_issue_comment::delete::Error), + #[error(transparent)] + ApiIssueComment_GetEntityTag(#[from] api_issue_comment::get_entity_tag::Error), + #[error(transparent)] + ApiIssueAttachment_ListByService(#[from] api_issue_attachment::list_by_service::Error), + #[error(transparent)] + ApiIssueAttachment_Get(#[from] api_issue_attachment::get::Error), + #[error(transparent)] + ApiIssueAttachment_CreateOrUpdate(#[from] api_issue_attachment::create_or_update::Error), + #[error(transparent)] + ApiIssueAttachment_Delete(#[from] api_issue_attachment::delete::Error), + #[error(transparent)] + ApiIssueAttachment_GetEntityTag(#[from] api_issue_attachment::get_entity_tag::Error), + #[error(transparent)] + ApiTagDescription_ListByService(#[from] api_tag_description::list_by_service::Error), + #[error(transparent)] + ApiTagDescription_Get(#[from] api_tag_description::get::Error), + #[error(transparent)] + ApiTagDescription_CreateOrUpdate(#[from] api_tag_description::create_or_update::Error), + #[error(transparent)] + ApiTagDescription_Delete(#[from] api_tag_description::delete::Error), + #[error(transparent)] + ApiTagDescription_GetEntityTag(#[from] api_tag_description::get_entity_tag::Error), + #[error(transparent)] + Tag_ListByApi(#[from] tag::list_by_api::Error), + #[error(transparent)] + Tag_GetByApi(#[from] tag::get_by_api::Error), + #[error(transparent)] + Tag_AssignToApi(#[from] tag::assign_to_api::Error), + #[error(transparent)] + Tag_DetachFromApi(#[from] tag::detach_from_api::Error), + #[error(transparent)] + Tag_GetEntityStateByApi(#[from] tag::get_entity_state_by_api::Error), + #[error(transparent)] + Operation_ListByTags(#[from] operation::list_by_tags::Error), + #[error(transparent)] Api_ListByTags(#[from] api::list_by_tags::Error), #[error(transparent)] ApiVersionSet_ListByService(#[from] api_version_set::list_by_service::Error), @@ -922,6 +1107,109 @@ pub mod api { use super::models; 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, + tags: None, + expand_api_version_set: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + delete_revisions: None, + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } pub fn list_by_tags( &self, resource_group_name: impl Into, @@ -940,7 +1228,7 @@ pub mod api { } } } - pub mod list_by_tags { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -973,7 +1261,8 @@ pub mod api { pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, - pub(crate) include_not_tagged_apis: Option, + pub(crate) tags: Option, + pub(crate) expand_api_version_set: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -988,14 +1277,18 @@ pub mod api { self.skip = Some(skip); self } - pub fn include_not_tagged_apis(mut self, include_not_tagged_apis: bool) -> Self { - self.include_not_tagged_apis = Some(include_not_tagged_apis); + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.into()); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn expand_api_version_set(mut self, expand_api_version_set: bool) -> Self { + self.expand_api_version_set = Some(expand_api_version_set); + 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/{}/apisByTags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -1020,9 +1313,12 @@ pub mod api { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } - if let Some(include_not_tagged_apis) = &self.include_not_tagged_apis { + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } + if let Some(expand_api_version_set) = &self.expand_api_version_set { url.query_pairs_mut() - .append_pair("includeNotTaggedApis", &include_not_tagged_apis.to_string()); + .append_pair("expandApiVersionSet", &expand_api_version_set.to_string()); } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); @@ -1032,7 +1328,7 @@ pub mod api { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagResourceCollection = + let rsp_value: models::ApiCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1050,255 +1346,48 @@ pub mod api { } } } -} -pub mod api_version_set { - use super::models; - 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, - version_set_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(), - version_set_id: version_set_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - version_set_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(), - version_set_id: version_set_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - version_set_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - version_set_id: version_set_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - version_set_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(), - version_set_id: version_set_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, - version_set_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(), - version_set_id: version_set_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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/{}/apiVersionSets", - 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", "2021-08-01"); - 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::ApiVersionSetCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_id: String, + pub(crate) api_id: String, 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.ApiManagement/service/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1318,7 +1407,7 @@ pub mod api_version_set { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiVersionSetContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1340,8 +1429,9 @@ pub mod api_version_set { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::ApiVersionSetContract), - Ok200(models::ApiVersionSetContract), + Created201(models::ApiContract), + Accepted202, + Ok200(models::ApiContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1370,8 +1460,8 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, - pub(crate) parameters: models::ApiVersionSetContract, + pub(crate) api_id: String, + pub(crate) parameters: models::ApiCreateOrUpdateParameter, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -1383,12 +1473,12 @@ pub mod api_version_set { 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/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1412,13 +1502,14 @@ pub mod api_version_set { 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::ApiVersionSetContract = + let rsp_value: models::ApiContract = 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), http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiVersionSetContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -1465,21 +1556,21 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, - pub(crate) parameters: models::ApiVersionSetUpdateParameters, + pub(crate) api_id: String, + pub(crate) parameters: models::ApiUpdateContract, pub(crate) if_match: String, 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.ApiManagement/service/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1501,7 +1592,7 @@ pub mod api_version_set { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiVersionSetContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1553,20 +1644,25 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, + pub(crate) api_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) delete_revisions: Option, } impl Builder { + pub fn delete_revisions(mut self, delete_revisions: bool) -> Self { + self.delete_revisions = Some(delete_revisions); + 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/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1578,6 +1674,9 @@ pub mod api_version_set { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(delete_revisions) = &self.delete_revisions { + url.query_pairs_mut().append_pair("deleteRevisions", &delete_revisions.to_string()); + } 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()); @@ -1630,19 +1729,19 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, + pub(crate) api_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/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1675,128 +1774,7 @@ pub mod api_version_set { } } } -} -pub mod authorization_server { - use super::models; - 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, - authsid: 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(), - authsid: authsid.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: 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(), - authsid: authsid.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - authsid: authsid.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: 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(), - authsid: authsid.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, - authsid: 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(), - authsid: authsid.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_secrets( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: impl Into, - subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - authsid: authsid.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod list_by_tags { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1829,6 +1807,7 @@ pub mod authorization_server { pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, + pub(crate) include_not_tagged_apis: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -1843,12 +1822,14 @@ pub mod authorization_server { self.skip = Some(skip); self } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn include_not_tagged_apis(mut self, include_not_tagged_apis: bool) -> Self { + self.include_not_tagged_apis = Some(include_not_tagged_apis); + 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/{}/authorizationServers", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apisByTags", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -1873,6 +1854,10 @@ pub mod authorization_server { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } + if let Some(include_not_tagged_apis) = &self.include_not_tagged_apis { + url.query_pairs_mut() + .append_pair("includeNotTaggedApis", &include_not_tagged_apis.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)?; @@ -1881,7 +1866,7 @@ pub mod authorization_server { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerCollection = + let rsp_value: models::TagResourceCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1899,7 +1884,31 @@ pub mod authorization_server { } } } - pub mod get { +} +pub mod api_revision { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1928,21 +1937,34 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, + pub(crate) api_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/revisions", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1954,6 +1976,15 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + 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)?; @@ -1962,7 +1993,7 @@ pub mod authorization_server { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerContract = + let rsp_value: models::ApiRevisionCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1980,63 +2011,185 @@ pub mod authorization_server { } } } - pub mod create_or_update { - use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::AuthorizationServerContract), - Ok200(models::AuthorizationServerContract), +} +pub mod api_release { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } } - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_id.into(), + subscription_id: subscription_id.into(), + } } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + release_id: release_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_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, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: String, - pub(crate) parameters: models::AuthorizationServerContract, + pub(crate) api_id: String, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + 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> { + 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2044,27 +2197,26 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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); + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerContract = - 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::AuthorizationServerContract = + let rsp_value: models::ApiReleaseCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -2080,7 +2232,7 @@ pub mod authorization_server { } } } - pub mod update { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2109,27 +2261,25 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, - pub(crate) parameters: models::AuthorizationServerUpdateContract, - pub(crate) if_match: String, + pub(crate) api_id: String, + pub(crate) release_id: String, 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.ApiManagement/service/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2137,9 +2287,7 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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.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)?; @@ -2147,7 +2295,7 @@ pub mod authorization_server { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerContract = + let rsp_value: models::ApiReleaseContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2165,12 +2313,12 @@ pub mod authorization_server { } } } - pub mod delete { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200, - NoContent204, + Created201(models::ApiReleaseContract), + Ok200(models::ApiReleaseContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2199,24 +2347,31 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, - pub(crate) if_match: String, + pub(crate) api_id: String, + pub(crate) release_id: String, + pub(crate) parameters: models::ApiReleaseContract, 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2224,15 +2379,28 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - req_builder = req_builder.header("If-Match", &self.if_match); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiReleaseContract = + 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::ApiReleaseContract = + 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 = @@ -2247,7 +2415,7 @@ pub mod authorization_server { } } } - pub mod get_entity_tag { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2276,23 +2444,27 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, + pub(crate) api_id: String, + pub(crate) release_id: String, + pub(crate) parameters: models::ApiReleaseContract, + pub(crate) if_match: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2300,13 +2472,20 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiReleaseContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -2321,8 +2500,13 @@ pub mod authorization_server { } } } - pub mod list_secrets { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -2350,18 +2534,26 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, + pub(crate) api_id: String, + pub(crate) release_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> { + 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/{}/authorizationServers/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . authsid) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2369,19 +2561,15 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("If-Match", &self.if_match); 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::AuthorizationServerSecretsContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -2396,39 +2584,120 @@ pub mod authorization_server { } } } -} -pub mod backend { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_service( - &self, + pub mod get_entity_tag { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) release_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/{}/apis/{}/releases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.release_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_operation { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, resource_group_name: impl Into, service_name: impl Into, + api_id: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> list_by_api::Builder { + list_by_api::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, + tags: None, } } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, + api_id: impl Into, + operation_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(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), } } @@ -2436,15 +2705,17 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_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(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -2454,8 +2725,9 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -2463,7 +2735,8 @@ pub mod backend { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), @@ -2473,7 +2746,8 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, + api_id: impl Into, + operation_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -2481,7 +2755,8 @@ pub mod backend { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -2490,35 +2765,21 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, + api_id: impl Into, + operation_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(), - backend_id: backend_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn reconnect( - &self, - resource_group_name: impl Into, - service_name: impl Into, - backend_id: impl Into, - subscription_id: impl Into, - ) -> reconnect::Builder { - reconnect::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), - parameters: None, } } } - pub mod list_by_service { + pub mod list_by_api { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2547,10 +2808,12 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) api_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, + pub(crate) tags: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -2565,14 +2828,19 @@ pub mod backend { self.skip = Some(skip); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.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/{}/backends", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2593,6 +2861,9 @@ pub mod backend { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -2601,7 +2872,7 @@ pub mod backend { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackendCollection = + let rsp_value: models::OperationCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2648,19 +2919,21 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, 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.ApiManagement/service/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2680,7 +2953,7 @@ pub mod backend { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackendContract = + let rsp_value: models::OperationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2702,8 +2975,8 @@ pub mod backend { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::BackendContract), - Ok200(models::BackendContract), + Created201(models::OperationContract), + Ok200(models::OperationContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2732,8 +3005,9 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, - pub(crate) parameters: models::BackendContract, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) parameters: models::OperationContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -2745,12 +3019,13 @@ pub mod backend { 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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2774,13 +3049,13 @@ pub mod backend { 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::BackendContract = + let rsp_value: models::OperationContract = 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::BackendContract = + let rsp_value: models::OperationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -2827,21 +3102,23 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, - pub(crate) parameters: models::BackendUpdateParameters, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) parameters: models::OperationUpdateContract, pub(crate) if_match: String, 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.ApiManagement/service/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2863,7 +3140,7 @@ pub mod backend { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackendContract = + let rsp_value: models::OperationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2915,7 +3192,8 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -2923,12 +3201,13 @@ pub mod backend { 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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2992,19 +3271,21 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, + pub(crate) api_id: String, + pub(crate) operation_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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -3037,167 +3318,77 @@ pub mod backend { } } } - pub mod reconnect { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) backend_id: 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<(), Error>> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}/reconnect", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.backend_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", "2021-08-01"); - 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::ACCEPTED => 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 cache { +pub mod api_operation_policy { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_service( + pub fn list_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> list_by_operation::Builder { + list_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), - top: None, - skip: None, } } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_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(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), + format: None, } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_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(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, } } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - cache_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - cache_id: cache_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -3205,7 +3396,9 @@ pub mod cache { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -3214,19 +3407,23 @@ pub mod cache { &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_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(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_service { + pub mod list_by_operation { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3255,27 +3452,21 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, pub(crate) subscription_id: String, - pub(crate) top: Option, - pub(crate) skip: Option, } impl Builder { - 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> { + 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/{}/caches", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -3287,12 +3478,6 @@ pub mod cache { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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)?; @@ -3301,7 +3486,7 @@ pub mod cache { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CacheCollection = + let rsp_value: models::PolicyCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -3348,20 +3533,20 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_id: String, pub(crate) subscription_id: String, + pub(crate) format: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3372,6 +3557,9 @@ pub mod cache { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -3380,7 +3568,7 @@ pub mod cache { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CacheContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -3402,8 +3590,8 @@ pub mod cache { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::CacheContract), - Ok200(models::CacheContract), + Created201(models::PolicyContract), + Ok200(models::PolicyContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3432,8 +3620,10 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, - pub(crate) parameters: models::CacheContract, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -3444,14 +3634,7 @@ pub mod cache { } 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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3474,13 +3657,13 @@ pub mod cache { 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::CacheContract = + let rsp_value: models::PolicyContract = 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::CacheContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -3498,89 +3681,6 @@ pub mod cache { } } } - pub mod update { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) cache_id: String, - pub(crate) parameters: models::CacheUpdateParameters, - 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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_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", "2021-08-01"); - 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.header("If-Match", &self.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::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CacheContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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; #[derive(Debug)] @@ -3615,21 +3715,16 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3692,20 +3787,15 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3738,109 +3828,8262 @@ pub mod cache { } } } -pub mod certificate { +pub mod tag { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_service( + pub fn list_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> list_by_operation::Builder { + list_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, - is_key_vault_refresh_failed: None, } } - pub fn get( + pub fn get_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> get::Builder { - get::Builder { + ) -> get_by_operation::Builder { + get_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), } } - pub fn create_or_update( + pub fn assign_to_operation( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> create_or_update::Builder { - create_or_update::Builder { + ) -> assign_to_operation::Builder { + assign_to_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), - parameters: parameters.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), - if_match: None, } } - pub fn delete( + pub fn detach_from_operation( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, - if_match: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> delete::Builder { - delete::Builder { + ) -> detach_from_operation::Builder { + detach_from_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), - if_match: if_match.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), } } - pub fn get_entity_tag( + pub fn get_entity_state_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> get_entity_tag::Builder { - get_entity_tag::Builder { + ) -> get_entity_state_by_operation::Builder { + get_entity_state_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), } } - pub fn refresh_secret( + pub fn list_by_api( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, + api_id: impl Into, subscription_id: impl Into, - ) -> refresh_secret::Builder { - refresh_secret::Builder { + ) -> list_by_api::Builder { + list_by_api::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_by_api::Builder { + get_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn assign_to_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> assign_to_api::Builder { + assign_to_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn detach_from_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> detach_from_api::Builder { + detach_from_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state_by_api::Builder { + get_entity_state_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list_by_product::Builder { + list_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_by_product::Builder { + get_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn assign_to_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> assign_to_product::Builder { + assign_to_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn detach_from_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> detach_from_product::Builder { + detach_from_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state_by_product::Builder { + get_entity_state_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + 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, + scope: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_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(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_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(), + tag_id: tag_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + tag_id: tag_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_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(), + tag_id: tag_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state::Builder { + get_entity_state::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: 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/{}/apis/{}/operations/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2021-08-01"); + 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::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 assign_to_operation { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TagContract = + 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::TagContract = + 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 detach_from_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_state_by_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2021-08-01"); + 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::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 assign_to_api { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TagContract = + 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::TagContract = + 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 detach_from_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_state_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_by_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: 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/{}/products/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_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", "2021-08-01"); + 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::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 assign_to_product { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TagContract = + 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::TagContract = + 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 detach_from_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_state_by_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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, + pub(crate) scope: 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 scope(mut self, scope: impl Into) -> Self { + self.scope = Some(scope.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/{}/tags", + 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", "2021-08-01"); + 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()); + } + if let Some(scope) = &self.scope { + url.query_pairs_mut().append_pair("scope", scope); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_id: String, + pub(crate) parameters: models::TagCreateUpdateParameters, + 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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2021-08-01"); + 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::TagContract = + 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::TagContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_id: String, + pub(crate) parameters: models::TagCreateUpdateParameters, + 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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2021-08-01"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2021-08-01"); + 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_state { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_product { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_apis( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_apis::Builder { + list_by_apis::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list_by_apis { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/products", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2021-08-01"); + 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::ProductCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 api_policy { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + format: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_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, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_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, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_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/{}/apis/{}/policies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match 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)?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_id: String, + pub(crate) subscription_id: String, + pub(crate) format: Option, + } + impl Builder { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2021-08-01"); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, + 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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2021-08-01"); + 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::PolicyContract = + 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::PolicyContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2021-08-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_schema { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.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, + api_id: 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(), + api_id: api_id.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, + api_id: 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(), + api_id: api_id.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, + api_id: 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(), + api_id: api_id.into(), + schema_id: schema_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + force: None, + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + schema_id: schema_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/schemas", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2021-08-01"); + 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::SchemaCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SchemaContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Accepted202, + Created201(models::SchemaContract), + Ok200(models::SchemaContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) schema_id: String, + pub(crate) parameters: models::SchemaContract, + 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2021-08-01"); + 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::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SchemaContract = + 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::SchemaContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) schema_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + pub(crate) force: Option, + } + impl Builder { + pub fn force(mut self, force: bool) -> Self { + self.force = Some(force); + 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2021-08-01"); + if let Some(force) = &self.force { + url.query_pairs_mut().append_pair("force", &force.to_string()); + } + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_diagnostic { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.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, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_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, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/diagnostics", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2021-08-01"); + 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::DiagnosticCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::DiagnosticContract), + Ok200(models::DiagnosticContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + 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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2021-08-01"); + 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::DiagnosticContract = + 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::DiagnosticContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + 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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2021-08-01"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2021-08-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_issue { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + expand_comments_attachments: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + expand_comments_attachments: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + issue_id: issue_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_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, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) expand_comments_attachments: 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 expand_comments_attachments(mut self, expand_comments_attachments: bool) -> Self { + self.expand_comments_attachments = Some(expand_comments_attachments); + 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/{}/apis/{}/issues", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2021-08-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(expand_comments_attachments) = &self.expand_comments_attachments { + url.query_pairs_mut() + .append_pair("expandCommentsAttachments", &expand_comments_attachments.to_string()); + } + 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::IssueCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) subscription_id: String, + pub(crate) expand_comments_attachments: Option, + } + impl Builder { + pub fn expand_comments_attachments(mut self, expand_comments_attachments: bool) -> Self { + self.expand_comments_attachments = Some(expand_comments_attachments); + 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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2021-08-01"); + if let Some(expand_comments_attachments) = &self.expand_comments_attachments { + url.query_pairs_mut() + .append_pair("expandCommentsAttachments", &expand_comments_attachments.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::IssueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueContract), + Ok200(models::IssueContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) parameters: models::IssueContract, + 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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2021-08-01"); + 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::IssueContract = + 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::IssueContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) parameters: models::IssueUpdateContract, + 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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2021-08-01"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2021-08-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_issue_comment { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: 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(), + api_id: api_id.into(), + issue_id: issue_id.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, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_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, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_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, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: 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/{}/apis/{}/issues/{}/comments", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2021-08-01"); + 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::IssueCommentCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueCommentContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueCommentContract), + Ok200(models::IssueCommentContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_id: String, + pub(crate) parameters: models::IssueCommentContract, + 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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2021-08-01"); + 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::IssueCommentContract = + 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::IssueCommentContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2021-08-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_issue_attachment { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: 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(), + api_id: api_id.into(), + issue_id: issue_id.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, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_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, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_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, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: 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/{}/apis/{}/issues/{}/attachments", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2021-08-01"); + 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::IssueAttachmentCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueAttachmentContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueAttachmentContract), + Ok200(models::IssueAttachmentContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_id: String, + pub(crate) parameters: models::IssueAttachmentContract, + 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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2021-08-01"); + 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::IssueAttachmentContract = + 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::IssueAttachmentContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2021-08-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_tag_description { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.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, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_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, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_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, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/tagDescriptions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2021-08-01"); + 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::TagDescriptionCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagDescriptionContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::TagDescriptionContract), + Ok200(models::TagDescriptionContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_id: String, + pub(crate) parameters: models::TagDescriptionCreateParameters, + 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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2021-08-01"); + 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::TagDescriptionContract = + 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::TagDescriptionContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2021-08-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 operation { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_tags( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_tags::Builder { + list_by_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + include_not_tagged_operations: None, + } + } + } + pub mod list_by_tags { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) include_not_tagged_operations: 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 include_not_tagged_operations(mut self, include_not_tagged_operations: bool) -> Self { + self.include_not_tagged_operations = Some(include_not_tagged_operations); + 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/{}/apis/{}/operationsByTags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2021-08-01"); + 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()); + } + if let Some(include_not_tagged_operations) = &self.include_not_tagged_operations { + url.query_pairs_mut() + .append_pair("includeNotTaggedOperations", &include_not_tagged_operations.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::TagResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 api_version_set { + use super::models; + 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, + version_set_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(), + version_set_id: version_set_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_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(), + version_set_id: version_set_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + version_set_id: version_set_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_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(), + version_set_id: version_set_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, + version_set_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(), + version_set_id: version_set_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/apiVersionSets", + 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", "2021-08-01"); + 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::ApiVersionSetCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiVersionSetContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::ApiVersionSetContract), + Ok200(models::ApiVersionSetContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_id: String, + pub(crate) parameters: models::ApiVersionSetContract, + 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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2021-08-01"); + 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::ApiVersionSetContract = + 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::ApiVersionSetContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_id: String, + pub(crate) parameters: models::ApiVersionSetUpdateParameters, + 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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2021-08-01"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiVersionSetContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2021-08-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 authorization_server { + use super::models; + 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, + authsid: 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(), + authsid: authsid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: 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(), + authsid: authsid.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + authsid: authsid.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: 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(), + authsid: authsid.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, + authsid: 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(), + authsid: authsid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + authsid: authsid.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/authorizationServers", + 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", "2021-08-01"); + 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::AuthorizationServerCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationServerContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::AuthorizationServerContract), + Ok200(models::AuthorizationServerContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: String, + pub(crate) parameters: models::AuthorizationServerContract, + 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2021-08-01"); + 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::AuthorizationServerContract = + 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::AuthorizationServerContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: String, + pub(crate) parameters: models::AuthorizationServerUpdateContract, + 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2021-08-01"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationServerContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2021-08-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_secrets { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . authsid) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + 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::AuthorizationServerSecretsContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 backend { + use super::models; + 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, + backend_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(), + backend_id: backend_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_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(), + backend_id: backend_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + backend_id: backend_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_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(), + backend_id: backend_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, + backend_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(), + backend_id: backend_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn reconnect( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_id: impl Into, + subscription_id: impl Into, + ) -> reconnect::Builder { + reconnect::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + backend_id: backend_id.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/backends", + 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", "2021-08-01"); + 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::BackendCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) backend_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/{}/backends/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.backend_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackendContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::BackendContract), + Ok200(models::BackendContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) backend_id: String, + pub(crate) parameters: models::BackendContract, + 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/{}/backends/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.backend_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", "2021-08-01"); + 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::BackendContract = + 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::BackendContract = + 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 list_by_service { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3869,41 +12112,25 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) backend_id: String, + pub(crate) parameters: models::BackendUpdateParameters, + pub(crate) if_match: String, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, - pub(crate) is_key_vault_refresh_failed: 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 is_key_vault_refresh_failed(mut self, is_key_vault_refresh_failed: bool) -> Self { - self.is_key_vault_refresh_failed = Some(is_key_vault_refresh_failed); - self - } - 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.ApiManagement/service/{}/certificates", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.backend_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -3911,20 +12138,9 @@ pub mod certificate { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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()); - } - if let Some(is_key_vault_refresh_failed) = &self.is_key_vault_refresh_failed { - url.query_pairs_mut() - .append_pair("isKeyVaultRefreshFailed", &is_key_vault_refresh_failed.to_string()); - } - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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)?; @@ -3932,7 +12148,7 @@ pub mod certificate { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CertificateCollection = + let rsp_value: models::BackendContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -3950,8 +12166,13 @@ pub mod certificate { } } } - pub mod get { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -3979,23 +12200,24 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, + pub(crate) backend_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> { + 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/{}/certificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.certificate_id + &self.backend_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4003,18 +12225,15 @@ pub mod certificate { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CertificateContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -4029,13 +12248,8 @@ pub mod certificate { } } } - pub mod create_or_update { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::CertificateContract), - Ok200(models::CertificateContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -4063,29 +12277,23 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, - pub(crate) parameters: models::CertificateCreateOrUpdateParameters, + pub(crate) backend_id: String, 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> { + 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/{}/certificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.certificate_id + &self.backend_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4093,28 +12301,13 @@ pub mod certificate { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::CertificateContract = - 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::CertificateContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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 = @@ -4129,13 +12322,8 @@ pub mod certificate { } } } - pub mod delete { + pub mod reconnect { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -4163,24 +12351,28 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, - pub(crate) if_match: String, + pub(crate) backend_id: String, pub(crate) subscription_id: String, + pub(crate) parameters: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}/reconnect", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.certificate_id + &self.backend_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4188,15 +12380,18 @@ pub mod certificate { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - req_builder = req_builder.header("If-Match", &self.if_match); - let req_body = azure_core::EMPTY_BODY; + 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::NO_CONTENT => Ok(Response::NoContent204), + 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::ErrorResponse = @@ -4211,7 +12406,112 @@ pub mod certificate { } } } - pub mod get_entity_tag { +} +pub mod cache { + use super::models; + 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(), + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_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(), + cache_id: cache_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_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(), + cache_id: cache_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + cache_id: cache_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_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(), + cache_id: cache_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, + cache_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(), + cache_id: cache_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4240,23 +12540,31 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/certificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.certificate_id + &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::HEAD); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4264,13 +12572,24 @@ pub mod certificate { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + 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 => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CacheCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -4285,7 +12604,7 @@ pub mod certificate { } } } - pub mod refresh_secret { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4314,228 +12633,63 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, + pub(crate) cache_id: String, 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.ApiManagement/service/{}/certificates/{}/refreshSecret", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.certificate_id + &self.cache_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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::CertificateContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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, - }) - } - } - }) - } - } - } -} -impl Client { - pub fn perform_connectivity_check_async( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - connectivity_check_request_params: impl Into, - ) -> perform_connectivity_check_async::Builder { - perform_connectivity_check_async::Builder { - client: self.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - subscription_id: subscription_id.into(), - connectivity_check_request_params: connectivity_check_request_params.into(), - } - } -} -pub mod perform_connectivity_check_async { - use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Ok200(models::ConnectivityCheckResponse), - } - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) subscription_id: String, - pub(crate) connectivity_check_request_params: models::ConnectivityCheckRequest, - } - impl Builder { - 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/{}/connectivityCheck", - 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", "2021-08-01"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.connectivity_check_request_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::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::ConnectivityCheckResponse = - 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 content_type { - use super::models; - 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(), - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - content_type_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(), - content_type_id: content_type_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - content_type_id: 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(), - content_type_id: content_type_id.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - content_type_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(), - content_type_id: content_type_id.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CacheContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_service { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::CacheContract), + Ok200(models::CacheContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -4563,21 +12717,29 @@ pub mod content_type { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) cache_id: String, + pub(crate) parameters: models::CacheContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/contentTypes", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.cache_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4585,17 +12747,27 @@ pub mod content_type { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; + 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::CacheContract = + 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::ContentTypeCollection = + let rsp_value: models::CacheContract = 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)?; @@ -4611,7 +12783,7 @@ pub mod content_type { } } } - pub mod get { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4640,23 +12812,25 @@ pub mod content_type { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, + pub(crate) cache_id: String, + pub(crate) parameters: models::CacheUpdateParameters, + pub(crate) if_match: String, 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.ApiManagement/service/{}/contentTypes/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.content_type_id + &self.cache_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4664,7 +12838,9 @@ pub mod content_type { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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)?; @@ -4672,7 +12848,7 @@ pub mod content_type { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ContentTypeContract = + let rsp_value: models::CacheContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -4690,12 +12866,12 @@ pub mod content_type { } } } - pub mod create_or_update { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::ContentTypeContract), - Ok200(models::ContentTypeContract), + Ok200, + NoContent204, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4724,28 +12900,24 @@ pub mod content_type { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, + pub(crate) cache_id: String, + pub(crate) if_match: String, 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/{}/contentTypes/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.content_type_id + &self.cache_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4753,27 +12925,15 @@ pub mod content_type { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - if let Some(if_match) = &self.if_match { - req_builder = req_builder.header("If-Match", if_match); - } + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ContentTypeContract = - 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::ContentTypeContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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 = @@ -4788,13 +12948,8 @@ pub mod content_type { } } } - pub mod delete { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -4822,24 +12977,23 @@ pub mod content_type { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) if_match: String, + pub(crate) cache_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.content_type_id + &self.cache_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4847,15 +13001,13 @@ pub mod content_type { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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), + 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 = @@ -4871,7 +13023,7 @@ pub mod content_type { } } } -pub mod content_item { +pub mod certificate { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -4879,31 +13031,31 @@ pub mod content_item { &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: 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(), - content_type_id: content_type_id.into(), subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + is_key_vault_refresh_failed: None, } } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: impl Into, - content_item_id: impl Into, + certificate_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(), - content_type_id: content_type_id.into(), - content_item_id: content_item_id.into(), + certificate_id: certificate_id.into(), subscription_id: subscription_id.into(), } } @@ -4911,16 +13063,16 @@ pub mod content_item { &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: impl Into, - content_item_id: impl Into, + certificate_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(), - content_type_id: content_type_id.into(), - content_item_id: content_item_id.into(), + certificate_id: certificate_id.into(), + parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, } @@ -4929,8 +13081,7 @@ pub mod content_item { &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: impl Into, - content_item_id: impl Into, + certificate_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -4938,8 +13089,7 @@ pub mod content_item { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - content_type_id: content_type_id.into(), - content_item_id: content_item_id.into(), + certificate_id: certificate_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -4948,100 +13098,34 @@ pub mod content_item { &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: impl Into, - content_item_id: impl Into, + certificate_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(), - content_type_id: content_type_id.into(), - content_item_id: content_item_id.into(), + certificate_id: certificate_id.into(), subscription_id: subscription_id.into(), } } - } - pub mod list_by_service { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) content_type_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/{}/contentTypes/{}/contentItems", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.content_type_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", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ContentItemCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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 refresh_secret( + &self, + resource_group_name: impl Into, + service_name: impl Into, + certificate_id: impl Into, + subscription_id: impl Into, + ) -> refresh_secret::Builder { + refresh_secret::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + certificate_id: certificate_id.into(), + subscription_id: subscription_id.into(), } } } - pub mod get { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5070,14 +13154,38 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) content_item_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) is_key_vault_refresh_failed: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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 is_key_vault_refresh_failed(mut self, is_key_vault_refresh_failed: bool) -> Self { + self.is_key_vault_refresh_failed = Some(is_key_vault_refresh_failed); + 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/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/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); @@ -5088,6 +13196,19 @@ pub mod content_item { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + 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()); + } + if let Some(is_key_vault_refresh_failed) = &self.is_key_vault_refresh_failed { + url.query_pairs_mut() + .append_pair("isKeyVaultRefreshFailed", &is_key_vault_refresh_failed.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)?; @@ -5096,7 +13217,7 @@ pub mod content_item { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ContentItemContract = + let rsp_value: models::CertificateCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -5114,13 +13235,8 @@ pub mod content_item { } } } - pub mod create_or_update { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ContentItemContract), - Ok200(models::ContentItemContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -5148,22 +13264,23 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) content_item_id: String, + pub(crate) certificate_id: String, 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> { + 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/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5171,26 +13288,17 @@ pub mod content_item { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - if let Some(if_match) = &self.if_match { - req_builder = req_builder.header("If-Match", 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ContentItemContract = - 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::ContentItemContract = + let rsp_value: models::CertificateContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -5206,12 +13314,12 @@ pub mod content_item { } } } - pub mod delete { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200, - NoContent204, + Created201(models::CertificateContract), + Ok200(models::CertificateContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5240,18 +13348,29 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) content_item_id: String, - pub(crate) if_match: String, + pub(crate) certificate_id: String, + pub(crate) parameters: models::CertificateCreateOrUpdateParameters, 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/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5259,137 +13378,49 @@ pub mod content_item { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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, - }) - } + 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); } - }) - } - } - } - pub mod get_entity_tag { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) content_type_id: String, - pub(crate) content_item_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/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_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", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = 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 => { + http::StatusCode::CREATED => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ErrorResponse = + let rsp_value: models::CertificateContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) + Ok(Response::Created201(rsp_value)) } - } - }) - } - } - } -} -pub mod deleted_services { - use super::models; - 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 get_by_name( - &self, - service_name: impl Into, - subscription_id: impl Into, - location: impl Into, - ) -> get_by_name::Builder { - get_by_name::Builder { - client: self.0.clone(), - service_name: service_name.into(), - subscription_id: subscription_id.into(), - location: location.into(), - } - } - pub fn purge( - &self, - service_name: impl Into, - subscription_id: impl Into, - location: impl Into, - ) -> purge::Builder { - purge::Builder { - client: self.0.clone(), - service_name: service_name.into(), - subscription_id: subscription_id.into(), - location: location.into(), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CertificateContract = + 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 list_by_subscription { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -5415,19 +13446,26 @@ pub mod deleted_services { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) certificate_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> { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.ApiManagement/deletedservices", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", self.client.endpoint(), - &self.subscription_id + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5435,18 +13473,15 @@ pub mod deleted_services { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DeletedServicesCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -5461,7 +13496,7 @@ pub mod deleted_services { } } } - pub mod get_by_name { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5488,23 +13523,25 @@ pub mod deleted_services { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) certificate_id: String, pub(crate) subscription_id: String, - pub(crate) location: 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.ApiManagement/locations/{}/deletedservices/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", self.client.endpoint(), &self.subscription_id, - &self.location, - &self.service_name + &self.resource_group_name, + &self.service_name, + &self.certificate_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5518,12 +13555,7 @@ pub mod deleted_services { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DeletedServiceContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -5538,14 +13570,8 @@ pub mod deleted_services { } } } - pub mod purge { + pub mod refresh_secret { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202(models::DeletedServiceContract), - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -5571,23 +13597,25 @@ pub mod deleted_services { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) certificate_id: String, pub(crate) subscription_id: String, - pub(crate) location: 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.ApiManagement/locations/{}/deletedservices/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}/refreshSecret", self.client.endpoint(), &self.subscription_id, - &self.location, - &self.service_name + &self.resource_group_name, + &self.service_name, + &self.certificate_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5596,19 +13624,18 @@ pub mod deleted_services { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); 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 => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DeletedServiceContract = + let rsp_value: models::CertificateContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Accepted202(rsp_value)) + Ok(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 = @@ -5623,16 +13650,176 @@ pub mod deleted_services { } } } -} -pub mod api_management_operations { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list(&self) -> list::Builder { - list::Builder { client: self.0.clone() } - } - } - pub mod list { +} +impl Client { + pub fn perform_connectivity_check_async( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + connectivity_check_request_params: impl Into, + ) -> perform_connectivity_check_async::Builder { + perform_connectivity_check_async::Builder { + client: self.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + connectivity_check_request_params: connectivity_check_request_params.into(), + } + } +} +pub mod perform_connectivity_check_async { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ConnectivityCheckResponse), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) connectivity_check_request_params: models::ConnectivityCheckRequest, + } + impl Builder { + 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/{}/connectivityCheck", + 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", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.connectivity_check_request_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::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::ConnectivityCheckResponse = + 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 content_type { + use super::models; + 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(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + content_type_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(), + content_type_id: content_type_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + content_type_id: 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(), + content_type_id: content_type_id.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + content_type_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(), + content_type_id: content_type_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5659,11 +13846,20 @@ pub mod api_management_operations { #[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, } 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.ApiManagement/operations", self.client.endpoint(),); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes", + 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); @@ -5682,7 +13878,7 @@ pub mod api_management_operations { match 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 = + let rsp_value: models::ContentTypeCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -5700,27 +13896,7 @@ pub mod api_management_operations { } } } -} -pub mod api_management_service_skus { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Gets available SKUs for API Management service"] - pub fn list_available_service_skus( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> list_available_service_skus::Builder { - list_available_service_skus::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_available_service_skus { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5749,213 +13925,62 @@ pub mod api_management_service_skus { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) content_type_id: String, 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.ApiManagement/service/{}/skus", - 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", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ResourceSkuResults = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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 api_management_service { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn restore( - &self, - resource_group_name: impl Into, - service_name: impl Into, - parameters: impl Into, - subscription_id: impl Into, - ) -> restore::Builder { - restore::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn backup( - &self, - resource_group_name: impl Into, - service_name: impl Into, - parameters: impl Into, - subscription_id: impl Into, - ) -> backup::Builder { - backup::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: 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(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - 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(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_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(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: 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(), - 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 fn get_sso_token( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> get_sso_token::Builder { - get_sso_token::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - subscription_id: subscription_id.into(), - } - } - 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 get_domain_ownership_identifier(&self, subscription_id: impl Into) -> get_domain_ownership_identifier::Builder { - get_domain_ownership_identifier::Builder { - client: self.0.clone(), - subscription_id: subscription_id.into(), - } - } - pub fn apply_network_configuration_updates( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> apply_network_configuration_updates::Builder { - apply_network_configuration_updates::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - subscription_id: subscription_id.into(), - parameters: None, + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.content_type_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContentTypeContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 restore { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, + Created201(models::ContentTypeContract), + Ok200(models::ContentTypeContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5984,22 +14009,28 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, + pub(crate) content_type_id: String, 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/{}/restore", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.content_type_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6007,20 +14038,27 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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); + } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ContentTypeContract = + 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::ApiManagementServiceResource = + let rsp_value: models::ContentTypeContract = 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 = @@ -6035,12 +14073,12 @@ pub mod api_management_service { } } } - pub mod backup { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, + Ok200, + NoContent204, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6069,22 +14107,24 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, + pub(crate) content_type_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/{}/backup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.content_type_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6092,20 +14132,15 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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.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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = - 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::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 = @@ -6120,7 +14155,99 @@ pub mod api_management_service { } } } - pub mod get { +} +pub mod content_item { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + content_type_id: 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(), + content_type_id: content_type_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + content_type_id: impl Into, + content_item_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(), + content_type_id: content_type_id.into(), + content_item_id: content_item_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + content_type_id: impl Into, + content_item_id: 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(), + content_type_id: content_type_id.into(), + content_item_id: content_item_id.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + content_type_id: impl Into, + content_item_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(), + content_type_id: content_type_id.into(), + content_item_id: content_item_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, + content_type_id: impl Into, + content_item_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(), + content_type_id: content_type_id.into(), + content_item_id: content_item_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6149,19 +14276,19 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) content_type_id: String, 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.ApiManagement/service/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.content_type_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -6181,7 +14308,7 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = + let rsp_value: models::ContentItemCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -6199,14 +14326,8 @@ pub mod api_management_service { } } } - pub mod create_or_update { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ApiManagementServiceResource), - Created201(models::ApiManagementServiceResource), - Accepted202, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6234,22 +14355,17 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceResource, + pub(crate) content_type_id: String, + pub(crate) content_item_id: String, 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.ApiManagement/service/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6257,8 +14373,7 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -6266,17 +14381,10 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = - 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::ApiManagementServiceResource = + let rsp_value: models::ContentItemContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Created201(rsp_value)) + Ok(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 = @@ -6291,12 +14399,12 @@ pub mod api_management_service { } } } - pub mod update { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, + Created201(models::ContentItemContract), + Ok200(models::ContentItemContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6325,22 +14433,22 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceUpdateParameters, + pub(crate) content_type_id: String, + pub(crate) content_item_id: String, 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/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6348,20 +14456,27 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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); + } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ContentItemContract = + 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::ApiManagementServiceResource = + let rsp_value: models::ContentItemContract = 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 = @@ -6381,7 +14496,6 @@ pub mod api_management_service { #[derive(Debug)] pub enum Response { Ok200, - Accepted202(models::ApiManagementServiceResource), NoContent204, } #[derive(Debug, thiserror :: Error)] @@ -6411,18 +14525,15 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) content_type_id: String, + pub(crate) content_item_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/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_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); @@ -6433,6 +14544,7 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + 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)?; @@ -6440,12 +14552,6 @@ pub mod api_management_service { 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::ApiManagementServiceResource = - 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)?; @@ -6461,7 +14567,7 @@ pub mod api_management_service { } } } - pub mod list_by_resource_group { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6489,22 +14595,18 @@ pub mod api_management_service { pub struct Builder { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) content_type_id: String, + pub(crate) content_item_id: String, 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<(), Error>> { Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6518,12 +14620,7 @@ pub mod api_management_service { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceListResult = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -6538,7 +14635,45 @@ pub mod api_management_service { } } } - pub mod list { +} +pub mod deleted_services { + use super::models; + 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 get_by_name( + &self, + service_name: impl Into, + subscription_id: impl Into, + location: impl Into, + ) -> get_by_name::Builder { + get_by_name::Builder { + client: self.0.clone(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + location: location.into(), + } + } + pub fn purge( + &self, + service_name: impl Into, + subscription_id: impl Into, + location: impl Into, + ) -> purge::Builder { + purge::Builder { + client: self.0.clone(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + location: location.into(), + } + } + } + pub mod list_by_subscription { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6568,12 +14703,10 @@ pub mod api_management_service { 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.ApiManagement/service", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/deletedservices", self.client.endpoint(), &self.subscription_id ); @@ -6595,7 +14728,7 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceListResult = + let rsp_value: models::DeletedServicesCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -6613,7 +14746,7 @@ pub mod api_management_service { } } } - pub mod get_sso_token { + pub mod get_by_name { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6640,26 +14773,23 @@ pub mod api_management_service { #[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) location: 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.ApiManagement/service/{}/getssotoken", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/locations/{}/deletedservices/{}", self.client.endpoint(), &self.subscription_id, - &self.resource_group_name, + &self.location, &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6668,7 +14798,6 @@ pub mod api_management_service { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); 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)?; @@ -6676,7 +14805,7 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceGetSsoTokenResult = + let rsp_value: models::DeletedServiceContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -6694,8 +14823,14 @@ pub mod api_management_service { } } } - pub mod check_name_availability { + pub mod purge { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::DeletedServiceContract), + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6721,23 +14856,23 @@ pub mod api_management_service { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) parameters: models::ApiManagementServiceCheckNameAvailabilityParameters, + pub(crate) service_name: String, pub(crate) subscription_id: String, + pub(crate) location: 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.ApiManagement/checkNameAvailability", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/locations/{}/deletedservices/{}", self.client.endpoint(), - &self.subscription_id + &self.subscription_id, + &self.location, + &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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6745,19 +14880,20 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { + 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::ApiManagementServiceNameAvailabilityResult = + let rsp_value: models::DeletedServiceContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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 = @@ -6772,7 +14908,16 @@ pub mod api_management_service { } } } - pub mod get_domain_ownership_identifier { +} +pub mod api_management_operations { + use super::models; + 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; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6799,24 +14944,14 @@ pub mod api_management_service { #[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, - > { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier", - self.client.endpoint(), - &self.subscription_id - ); + let url_str = &format!("{}/providers/Microsoft.ApiManagement/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::POST); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6825,7 +14960,6 @@ pub mod api_management_service { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); 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)?; @@ -6833,7 +14967,7 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceGetDomainOwnershipIdentifierResult = + let rsp_value: models::OperationListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -6851,13 +14985,28 @@ pub mod api_management_service { } } } - pub mod apply_network_configuration_updates { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, +} +pub mod api_management_service_skus { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets available SKUs for API Management service"] + pub fn list_available_service_skus( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_available_service_skus::Builder { + list_available_service_skus::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } } + } + pub mod list_available_service_skus { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6886,19 +15035,20 @@ pub mod api_management_service { pub(crate) resource_group_name: String, pub(crate) 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> { + 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/{}/applynetworkconfigurationupdates" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/skus", + 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6906,12 +15056,7 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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 - }; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -6919,11 +15064,10 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = + let rsp_value: models::ResourceSkuResults = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(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 = @@ -6939,38 +15083,50 @@ pub mod api_management_service { } } } -pub mod diagnostic { +pub mod api_management_service { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_service( + pub fn restore( &self, resource_group_name: impl Into, service_name: impl Into, + parameters: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> restore::Builder { + restore::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn backup( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> backup::Builder { + backup::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.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, - diagnostic_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(), - diagnostic_id: diagnostic_id.into(), subscription_id: subscription_id.into(), } } @@ -6978,36 +15134,29 @@ pub mod diagnostic { &self, resource_group_name: impl Into, service_name: impl Into, - diagnostic_id: impl Into, - parameters: 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(), - diagnostic_id: diagnostic_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), - if_match: None, } } pub fn update( &self, resource_group_name: impl Into, service_name: impl Into, - diagnostic_id: impl Into, - parameters: impl Into, - if_match: impl Into, + parameters: impl Into, subscription_id: impl Into, ) -> update::Builder { update::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - diagnostic_id: diagnostic_id.into(), parameters: parameters.into(), - if_match: if_match.into(), subscription_id: subscription_id.into(), } } @@ -7015,37 +15164,84 @@ pub mod diagnostic { &self, resource_group_name: impl Into, service_name: impl Into, - diagnostic_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(), - diagnostic_id: diagnostic_id.into(), - if_match: if_match.into(), subscription_id: subscription_id.into(), } } - pub fn get_entity_tag( + 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 fn get_sso_token( &self, resource_group_name: impl Into, service_name: impl Into, - diagnostic_id: impl Into, subscription_id: impl Into, - ) -> get_entity_tag::Builder { - get_entity_tag::Builder { + ) -> get_sso_token::Builder { + get_sso_token::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + 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 get_domain_ownership_identifier(&self, subscription_id: impl Into) -> get_domain_ownership_identifier::Builder { + get_domain_ownership_identifier::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn apply_network_configuration_updates( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> apply_network_configuration_updates::Builder { + apply_network_configuration_updates::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - diagnostic_id: diagnostic_id.into(), subscription_id: subscription_id.into(), + parameters: None, } } } - pub mod list_by_service { + pub mod restore { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7073,28 +15269,14 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, 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> { + 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/{}/diagnostics", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/restore", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -7102,7 +15284,7 @@ pub mod diagnostic { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7110,16 +15292,8 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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.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)?; @@ -7127,10 +15301,11 @@ pub mod diagnostic { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DiagnosticCollection = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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 = @@ -7145,8 +15320,13 @@ pub mod diagnostic { } } } - pub mod get { + pub mod backup { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7174,23 +15354,22 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, + pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, 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.ApiManagement/service/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backup", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7198,7 +15377,8 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; + 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)?; @@ -7206,10 +15386,11 @@ pub mod diagnostic { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DiagnosticContract = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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 = @@ -7224,13 +15405,8 @@ pub mod diagnostic { } } } - pub mod create_or_update { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::DiagnosticContract), - Ok200(models::DiagnosticContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7258,29 +15434,23 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, - pub(crate) parameters: models::DiagnosticContract, 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> { + 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/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7288,27 +15458,17 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::DiagnosticContract = - 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::DiagnosticContract = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -7324,8 +15484,14 @@ pub mod diagnostic { } } } - pub mod update { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Created201(models::ApiManagementServiceResource), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7353,25 +15519,22 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, - pub(crate) parameters: models::DiagnosticContract, - pub(crate) if_match: String, + pub(crate) parameters: models::ApiManagementServiceResource, 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.ApiManagement/service/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7381,7 +15544,6 @@ pub mod diagnostic { url.query_pairs_mut().append_pair("api-version", "2021-08-01"); 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.header("If-Match", &self.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)?; @@ -7389,10 +15551,17 @@ pub mod diagnostic { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DiagnosticContract = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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::ApiManagementServiceResource = + 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 = @@ -7407,12 +15576,12 @@ pub mod diagnostic { } } } - pub mod delete { + pub mod update { use super::models; #[derive(Debug)] pub enum Response { - Ok200, - NoContent204, + Ok200(models::ApiManagementServiceResource), + Accepted202, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7441,24 +15610,22 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, - pub(crate) if_match: String, + pub(crate) parameters: models::ApiManagementServiceUpdateParameters, pub(crate) subscription_id: String, } impl Builder { 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/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7466,15 +15633,20 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - req_builder = req_builder.header("If-Match", &self.if_match); - let req_body = azure_core::EMPTY_BODY; + 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::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceResource = + 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 = @@ -7489,8 +15661,14 @@ pub mod diagnostic { } } } - pub mod get_entity_tag { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::ApiManagementServiceResource), + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7518,23 +15696,21 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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::HEAD); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7548,7 +15724,14 @@ pub mod diagnostic { let rsp = 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(()), + 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::ApiManagementServiceResource = + 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 = @@ -7563,113 +15746,7 @@ pub mod diagnostic { } } } -} -pub mod email_template { - use super::models; - 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, - template_name: 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(), - template_name: template_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - template_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(), - service_name: service_name.into(), - template_name: template_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - template_name: impl Into, - if_match: impl Into, - parameters: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - template_name: template_name.into(), - if_match: if_match.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - template_name: 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(), - template_name: template_name.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, - template_name: 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(), - template_name: template_name.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod list_by_resource_group { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7697,33 +15774,18 @@ pub mod email_template { 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> { + 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/{}/templates", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service", self.client.endpoint(), &self.subscription_id, - &self.resource_group_name, - &self.service_name + &self.resource_group_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -7735,15 +15797,6 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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)?; @@ -7752,7 +15805,7 @@ pub mod email_template { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateCollection = + let rsp_value: models::ApiManagementServiceListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -7770,7 +15823,7 @@ pub mod email_template { } } } - pub mod get { + pub mod list { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7797,21 +15850,17 @@ pub mod email_template { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) template_name: String, 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.ApiManagement/service/{}/templates/{}", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/service", self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.template_name + &self.subscription_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -7831,7 +15880,7 @@ pub mod email_template { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateContract = + let rsp_value: models::ApiManagementServiceListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -7849,13 +15898,8 @@ pub mod email_template { } } } - pub mod create_or_update { + pub mod get_sso_token { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::EmailTemplateContract), - Ok200(models::EmailTemplateContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7883,29 +15927,24 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, - pub(crate) parameters: models::EmailTemplateUpdateParameters, 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> { + 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/{}/templates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/getssotoken", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.template_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7913,27 +15952,18 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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); - } + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateContract = - 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::EmailTemplateContract = + let rsp_value: models::ApiManagementServiceGetSsoTokenResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -7949,7 +15979,7 @@ pub mod email_template { } } } - pub mod update { + pub mod check_name_availability { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7976,27 +16006,23 @@ pub mod email_template { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) template_name: String, - pub(crate) if_match: String, - pub(crate) parameters: models::EmailTemplateUpdateParameters, + pub(crate) parameters: models::ApiManagementServiceCheckNameAvailabilityParameters, 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.ApiManagement/service/{}/templates/{}", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/checkNameAvailability", self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.template_name + &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::PATCH); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8004,7 +16030,6 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - req_builder = req_builder.header("If-Match", &self.if_match); 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()); @@ -8014,7 +16039,7 @@ pub mod email_template { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateContract = + let rsp_value: models::ApiManagementServiceNameAvailabilityResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -8032,13 +16057,8 @@ pub mod email_template { } } } - pub mod delete { + pub mod get_domain_ownership_identifier { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8064,26 +16084,24 @@ pub mod email_template { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) template_name: 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> { + 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/{}/templates/{}", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier", self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.template_name + &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::DELETE); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8091,15 +16109,19 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - req_builder = req_builder.header("If-Match", &self.if_match); 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceGetDomainOwnershipIdentifierResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -8114,8 +16136,13 @@ pub mod email_template { } } } - pub mod get_entity_tag { + pub mod apply_network_configuration_updates { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8143,23 +16170,20 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, pub(crate) subscription_id: String, + pub(crate) parameters: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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.ApiManagement/service/{}/templates/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.template_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/applynetworkconfigurationupdates" , 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::HEAD); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8167,13 +16191,24 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; + 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceResource = + 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 = @@ -8189,7 +16224,7 @@ pub mod email_template { } } } -pub mod gateway { +pub mod diagnostic { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -8213,14 +16248,14 @@ pub mod gateway { &self, resource_group_name: impl Into, service_name: impl Into, - gateway_id: impl Into, + diagnostic_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(), - gateway_id: gateway_id.into(), + diagnostic_id: diagnostic_id.into(), subscription_id: subscription_id.into(), } } @@ -8228,15 +16263,15 @@ pub mod gateway { &self, resource_group_name: impl Into, service_name: impl Into, - gateway_id: impl Into, - parameters: impl Into, + diagnostic_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(), - gateway_id: gateway_id.into(), + diagnostic_id: diagnostic_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -8246,8 +16281,8 @@ pub mod gateway { &self, resource_group_name: impl Into, service_name: impl Into, - gateway_id: impl Into, - parameters: impl Into, + diagnostic_id: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -8255,7 +16290,7 @@ pub mod gateway { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - gateway_id: gateway_id.into(), + diagnostic_id: diagnostic_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), @@ -8265,7 +16300,7 @@ pub mod gateway { &self, resource_group_name: impl Into, service_name: impl Into, - gateway_id: impl Into, + diagnostic_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -8273,7 +16308,7 @@ pub mod gateway { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - gateway_id: gateway_id.into(), + diagnostic_id: diagnostic_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -8282,69 +16317,205 @@ pub mod gateway { &self, resource_group_name: impl Into, service_name: impl Into, - gateway_id: impl Into, + diagnostic_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(), - gateway_id: gateway_id.into(), + diagnostic_id: diagnostic_id.into(), subscription_id: subscription_id.into(), } } - pub fn list_keys( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - subscription_id: impl Into, - ) -> list_keys::Builder { - list_keys::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - gateway_id: gateway_id.into(), - subscription_id: subscription_id.into(), - } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), } - pub fn regenerate_key( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: 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(), - service_name: service_name.into(), - gateway_id: gateway_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), + #[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/{}/diagnostics", + 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", "2021-08-01"); + 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::DiagnosticCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 generate_token( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - parameters: impl Into, - subscription_id: impl Into, - ) -> generate_token::Builder { - generate_token::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - gateway_id: gateway_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), + } + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) diagnostic_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/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.diagnostic_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_service { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::DiagnosticContract), + Ok200(models::DiagnosticContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8372,36 +16543,29 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, + pub(crate) if_match: 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); + 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> { + 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/{}/gateways", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8409,26 +16573,27 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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()); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::DiagnosticContract = + 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::GatewayCollection = + let rsp_value: models::DiagnosticContract = 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)?; @@ -8444,7 +16609,7 @@ pub mod gateway { } } } - pub mod get { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8473,23 +16638,25 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + pub(crate) if_match: String, 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.ApiManagement/service/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8497,7 +16664,9 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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)?; @@ -8505,7 +16674,7 @@ pub mod gateway { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayContract = + let rsp_value: models::DiagnosticContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -8523,12 +16692,12 @@ pub mod gateway { } } } - pub mod create_or_update { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::GatewayContract), - Ok200(models::GatewayContract), + Ok200, + NoContent204, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8557,29 +16726,100 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) parameters: models::GatewayContract, + pub(crate) diagnostic_id: String, + pub(crate) if_match: String, 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/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.diagnostic_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", "2021-08-01"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) diagnostic_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/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8587,28 +16827,13 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::GatewayContract = - 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::GatewayContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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 = @@ -8623,7 +16848,113 @@ pub mod gateway { } } } - pub mod update { +} +pub mod email_template { + use super::models; + 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, + template_name: 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(), + template_name: template_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + template_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(), + service_name: service_name.into(), + template_name: template_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + template_name: impl Into, + if_match: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + template_name: template_name.into(), + if_match: if_match.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + template_name: 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(), + template_name: template_name.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, + template_name: 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(), + template_name: template_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8652,25 +16983,36 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) parameters: models::GatewayContract, - pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.gateway_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8678,9 +17020,16 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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.header("If-Match", &self.if_match); + 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)?; @@ -8688,7 +17037,7 @@ pub mod gateway { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayContract = + let rsp_value: models::EmailTemplateCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -8706,13 +17055,8 @@ pub mod gateway { } } } - pub mod delete { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8740,24 +17084,23 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) if_match: String, + pub(crate) template_name: String, 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.ApiManagement/service/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8765,15 +17108,18 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EmailTemplateContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -8788,8 +17134,13 @@ pub mod gateway { } } } - pub mod get_entity_tag { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::EmailTemplateContract), + Ok200(models::EmailTemplateContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8817,23 +17168,29 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, + pub(crate) template_name: String, + pub(crate) parameters: models::EmailTemplateUpdateParameters, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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::HEAD); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8841,13 +17198,28 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(()), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EmailTemplateContract = + 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::EmailTemplateContract = + 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 = @@ -8862,7 +17234,7 @@ pub mod gateway { } } } - pub mod list_keys { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8891,23 +17263,25 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, + pub(crate) template_name: String, + pub(crate) if_match: String, + pub(crate) parameters: models::EmailTemplateUpdateParameters, 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.ApiManagement/service/{}/gateways/{}/listKeys", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8915,8 +17289,9 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.header("If-Match", &self.if_match); + 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)?; @@ -8924,7 +17299,7 @@ pub mod gateway { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayKeysContract = + let rsp_value: models::EmailTemplateContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -8942,8 +17317,13 @@ pub mod gateway { } } } - pub mod regenerate_key { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8971,24 +17351,24 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) parameters: models::GatewayKeyRegenerationRequestContract, + pub(crate) template_name: 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<(), Error>> { + 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/{}/gateways/{}/regenerateKey", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8996,14 +17376,15 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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.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::NO_CONTENT => Ok(()), + 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 = @@ -9018,7 +17399,7 @@ pub mod gateway { } } } - pub mod generate_token { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9047,24 +17428,23 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) parameters: models::GatewayTokenRequestContract, + pub(crate) template_name: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/generateToken", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9072,19 +17452,13 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayTokenContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -9100,7 +17474,7 @@ pub mod gateway { } } } -pub mod gateway_hostname_configuration { +pub mod gateway { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -9108,14 +17482,12 @@ pub mod gateway_hostname_configuration { &self, resource_group_name: impl Into, service_name: impl Into, - gateway_id: 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(), - gateway_id: gateway_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, @@ -9127,7 +17499,6 @@ pub mod gateway_hostname_configuration { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - hc_id: impl Into, subscription_id: impl Into, ) -> get::Builder { get::Builder { @@ -9135,7 +17506,6 @@ pub mod gateway_hostname_configuration { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - hc_id: hc_id.into(), subscription_id: subscription_id.into(), } } @@ -9144,8 +17514,7 @@ pub mod gateway_hostname_configuration { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - hc_id: impl Into, - parameters: impl Into, + parameters: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -9153,18 +17522,35 @@ pub mod gateway_hostname_configuration { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - hc_id: hc_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, } } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - hc_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -9173,7 +17559,6 @@ pub mod gateway_hostname_configuration { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - hc_id: hc_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -9183,7 +17568,6 @@ pub mod gateway_hostname_configuration { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - hc_id: impl Into, subscription_id: impl Into, ) -> get_entity_tag::Builder { get_entity_tag::Builder { @@ -9191,7 +17575,55 @@ pub mod gateway_hostname_configuration { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - hc_id: hc_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_keys( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + subscription_id: impl Into, + ) -> list_keys::Builder { + list_keys::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn regenerate_key( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: 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(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn generate_token( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> generate_token::Builder { + generate_token::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + parameters: parameters.into(), subscription_id: subscription_id.into(), } } @@ -9225,7 +17657,6 @@ pub mod gateway_hostname_configuration { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, @@ -9244,12 +17675,15 @@ pub mod gateway_hostname_configuration { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/gateways/{}/hostnameConfigurations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/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); @@ -9277,7 +17711,7 @@ pub mod gateway_hostname_configuration { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayHostnameConfigurationCollection = + let rsp_value: models::GatewayCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -9325,15 +17759,19 @@ pub mod gateway_hostname_configuration { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) hc_id: String, 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.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_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); @@ -9352,7 +17790,7 @@ pub mod gateway_hostname_configuration { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayHostnameConfigurationContract = + let rsp_value: models::GatewayContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -9374,8 +17812,8 @@ pub mod gateway_hostname_configuration { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::GatewayHostnameConfigurationContract), - Ok200(models::GatewayHostnameConfigurationContract), + Created201(models::GatewayContract), + Ok200(models::GatewayContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9405,8 +17843,7 @@ pub mod gateway_hostname_configuration { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) hc_id: String, - pub(crate) parameters: models::GatewayHostnameConfigurationContract, + pub(crate) parameters: models::GatewayContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -9417,7 +17854,14 @@ pub mod gateway_hostname_configuration { } 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/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_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); @@ -9428,11 +17872,11 @@ pub mod gateway_hostname_configuration { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + 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.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)?; @@ -9440,13 +17884,13 @@ pub mod gateway_hostname_configuration { 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::GatewayHostnameConfigurationContract = + let rsp_value: models::GatewayContract = 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::GatewayHostnameConfigurationContract = + let rsp_value: models::GatewayContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -9464,13 +17908,8 @@ pub mod gateway_hostname_configuration { } } } - pub mod delete { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9499,17 +17938,24 @@ pub mod gateway_hostname_configuration { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) hc_id: String, + pub(crate) parameters: models::GatewayContract, pub(crate) if_match: String, 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.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9517,15 +17963,20 @@ pub mod gateway_hostname_configuration { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + 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.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), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -9540,8 +17991,13 @@ pub mod gateway_hostname_configuration { } } } - pub mod get_entity_tag { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9570,16 +18026,23 @@ pub mod gateway_hostname_configuration { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) hc_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<(), Error>> { + 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/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9587,13 +18050,15 @@ pub mod gateway_hostname_configuration { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + 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(()), + 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 = @@ -9608,83 +18073,7 @@ pub mod gateway_hostname_configuration { } } } -} -pub mod gateway_api { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_service( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: 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(), - gateway_id: gateway_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - api_id: 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(), - gateway_id: gateway_id.into(), - api_id: api_id.into(), - subscription_id: subscription_id.into(), - parameters: None, - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - api_id: 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(), - gateway_id: gateway_id.into(), - api_id: api_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn get_entity_tag( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - api_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(), - gateway_id: gateway_id.into(), - api_id: api_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9715,27 +18104,12 @@ pub mod gateway_api { pub(crate) service_name: String, pub(crate) gateway_id: 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> { + 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/{}/gateways/{}/apis", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -9744,7 +18118,7 @@ pub mod gateway_api { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9752,27 +18126,13 @@ pub mod gateway_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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::ApiCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -9787,13 +18147,8 @@ pub mod gateway_api { } } } - pub mod create_or_update { + pub mod list_keys { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ApiContract), - Ok200(models::ApiContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9822,29 +18177,22 @@ pub mod gateway_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) api_id: 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> { + 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/{}/gateways/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/listKeys", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id, - &self.api_id + &self.gateway_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9852,28 +18200,18 @@ pub mod gateway_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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 - }; + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiContract = - 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::ApiContract = + let rsp_value: models::GatewayKeysContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -9889,13 +18227,8 @@ pub mod gateway_api { } } } - pub mod delete { + pub mod regenerate_key { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9924,24 +18257,23 @@ pub mod gateway_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) api_id: String, + pub(crate) parameters: models::GatewayKeyRegenerationRequestContract, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/regenerateKey", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id, - &self.api_id + &self.gateway_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9949,14 +18281,14 @@ pub mod gateway_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; + 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::NO_CONTENT => Ok(Response::NoContent204), + 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::ErrorResponse = @@ -9971,7 +18303,7 @@ pub mod gateway_api { } } } - pub mod get_entity_tag { + pub mod generate_token { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -10001,24 +18333,23 @@ pub mod gateway_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) api_id: String, + pub(crate) parameters: models::GatewayTokenRequestContract, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/gateways/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/generateToken", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id, - &self.api_id + &self.gateway_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -10026,13 +18357,19 @@ pub mod gateway_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; + 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayTokenContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -10048,7 +18385,7 @@ pub mod gateway_api { } } } -pub mod gateway_certificate_authority { +pub mod gateway_hostname_configuration { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -10075,7 +18412,7 @@ pub mod gateway_certificate_authority { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - certificate_id: impl Into, + hc_id: impl Into, subscription_id: impl Into, ) -> get::Builder { get::Builder { @@ -10083,7 +18420,7 @@ pub mod gateway_certificate_authority { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - certificate_id: certificate_id.into(), + hc_id: hc_id.into(), subscription_id: subscription_id.into(), } } @@ -10092,8 +18429,8 @@ pub mod gateway_certificate_authority { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - certificate_id: impl Into, - parameters: impl Into, + hc_id: impl Into, + parameters: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -10101,7 +18438,7 @@ pub mod gateway_certificate_authority { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - certificate_id: certificate_id.into(), + hc_id: hc_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -10112,7 +18449,7 @@ pub mod gateway_certificate_authority { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - certificate_id: impl Into, + hc_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -10121,7 +18458,7 @@ pub mod gateway_certificate_authority { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - certificate_id: certificate_id.into(), + hc_id: hc_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -10131,7 +18468,7 @@ pub mod gateway_certificate_authority { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - certificate_id: impl Into, + hc_id: impl Into, subscription_id: impl Into, ) -> get_entity_tag::Builder { get_entity_tag::Builder { @@ -10139,7 +18476,7 @@ pub mod gateway_certificate_authority { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - certificate_id: certificate_id.into(), + hc_id: hc_id.into(), subscription_id: subscription_id.into(), } } @@ -10194,10 +18531,10 @@ pub mod gateway_certificate_authority { } pub fn into_future( self, - ) -> futures::future::BoxFuture<'static, std::result::Result> + ) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_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); @@ -10225,7 +18562,7 @@ pub mod gateway_certificate_authority { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayCertificateAuthorityCollection = + let rsp_value: models::GatewayHostnameConfigurationCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -10273,15 +18610,15 @@ pub mod gateway_certificate_authority { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) certificate_id: String, + pub(crate) hc_id: String, pub(crate) subscription_id: String, } impl Builder { pub fn into_future( self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + ) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_id) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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); @@ -10300,7 +18637,7 @@ pub mod gateway_certificate_authority { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayCertificateAuthorityContract = + let rsp_value: models::GatewayHostnameConfigurationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -10322,8 +18659,8 @@ pub mod gateway_certificate_authority { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::GatewayCertificateAuthorityContract), - Ok200(models::GatewayCertificateAuthorityContract), + Created201(models::GatewayHostnameConfigurationContract), + Ok200(models::GatewayHostnameConfigurationContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -10353,8 +18690,8 @@ pub mod gateway_certificate_authority { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) certificate_id: String, - pub(crate) parameters: models::GatewayCertificateAuthorityContract, + pub(crate) hc_id: String, + pub(crate) parameters: models::GatewayHostnameConfigurationContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -10365,7 +18702,7 @@ pub mod gateway_certificate_authority { } 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/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_id) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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); @@ -10388,13 +18725,13 @@ pub mod gateway_certificate_authority { 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::GatewayCertificateAuthorityContract = + let rsp_value: models::GatewayHostnameConfigurationContract = 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::GatewayCertificateAuthorityContract = + let rsp_value: models::GatewayHostnameConfigurationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -10447,14 +18784,14 @@ pub mod gateway_certificate_authority { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) certificate_id: String, + pub(crate) hc_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/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_id) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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); @@ -10518,13 +18855,13 @@ pub mod gateway_certificate_authority { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) certificate_id: String, + pub(crate) hc_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/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_id) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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); @@ -10557,7 +18894,7 @@ pub mod gateway_certificate_authority { } } } -pub mod group { +pub mod gateway_api { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -10565,84 +18902,52 @@ pub mod group { &self, resource_group_name: impl Into, service_name: impl Into, + gateway_id: 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(), + gateway_id: gateway_id.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, - group_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(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), - } - } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - parameters: impl Into, + gateway_id: impl Into, + api_id: 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(), - group_id: group_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - group_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - group_id: group_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), + gateway_id: gateway_id.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), + parameters: None, } } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - if_match: impl Into, + gateway_id: impl Into, + api_id: 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(), - group_id: group_id.into(), - if_match: if_match.into(), + gateway_id: gateway_id.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), } } @@ -10650,14 +18955,16 @@ pub mod group { &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, + gateway_id: impl Into, + api_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(), - group_id: group_id.into(), + gateway_id: gateway_id.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), } } @@ -10691,6 +18998,7 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) gateway_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, @@ -10709,14 +19017,15 @@ pub mod group { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/groups", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.gateway_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -10745,86 +19054,7 @@ pub mod group { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GroupCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) group_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/{}/groups/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.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", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GroupContract = + let rsp_value: models::ApiCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -10846,104 +19076,9 @@ pub mod group { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::GroupContract), - Ok200(models::GroupContract), - } - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) group_id: String, - pub(crate) parameters: models::GroupCreateParameters, - 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/{}/groups/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.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::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", "2021-08-01"); - 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::GroupContract = - 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::GroupContract = - 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; + Created201(models::ApiContract), + Ok200(models::ApiContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -10971,25 +19106,30 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) parameters: models::GroupUpdateParameters, - pub(crate) if_match: String, + pub(crate) gateway_id: String, + pub(crate) api_id: String, pub(crate) subscription_id: String, + pub(crate) parameters: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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.ApiManagement/service/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.gateway_id, + &self.api_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -10997,19 +19137,28 @@ pub mod group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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.header("If-Match", &self.if_match); + 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::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiContract = + 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::GroupContract = + let rsp_value: models::ApiContract = 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)?; @@ -11059,20 +19208,21 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) if_match: String, + pub(crate) gateway_id: String, + pub(crate) api_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/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.gateway_id, + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -11084,7 +19234,6 @@ pub mod group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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)?; @@ -11136,19 +19285,21 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, + pub(crate) gateway_id: String, + pub(crate) api_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/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.gateway_id, + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -11182,81 +19333,103 @@ pub mod group { } } } -pub mod group_user { +pub mod gateway_certificate_authority { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, + gateway_id: impl Into, subscription_id: impl Into, - ) -> list::Builder { - list::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - group_id: group_id.into(), + gateway_id: gateway_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, } } - pub fn create( + pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - user_id: impl Into, + gateway_id: impl Into, + certificate_id: impl Into, subscription_id: impl Into, - ) -> create::Builder { - create::Builder { + ) -> get::Builder { + get::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - group_id: group_id.into(), - user_id: user_id.into(), + gateway_id: gateway_id.into(), + certificate_id: certificate_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + certificate_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(), + gateway_id: gateway_id.into(), + certificate_id: certificate_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, - group_id: impl Into, - user_id: impl Into, + gateway_id: impl Into, + certificate_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(), - group_id: group_id.into(), - user_id: user_id.into(), + gateway_id: gateway_id.into(), + certificate_id: certificate_id.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } - pub fn check_entity_exists( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - user_id: impl Into, + gateway_id: impl Into, + certificate_id: impl Into, subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - group_id: group_id.into(), - user_id: user_id.into(), + gateway_id: gateway_id.into(), + certificate_id: certificate_id.into(), subscription_id: subscription_id.into(), } } } - pub mod list { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11285,7 +19458,7 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, + pub(crate) gateway_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, @@ -11304,16 +19477,12 @@ pub mod group_user { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/groups/{}/users", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_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); @@ -11341,7 +19510,7 @@ pub mod group_user { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::UserCollection = + let rsp_value: models::GatewayCertificateAuthorityCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -11359,12 +19528,87 @@ pub mod group_user { } } } - pub mod create { + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) gateway_id: String, + pub(crate) certificate_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/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayCertificateAuthorityContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; #[derive(Debug)] pub enum Response { - Created201(models::UserContract), - Ok200(models::UserContract), + Created201(models::GatewayCertificateAuthorityContract), + Ok200(models::GatewayCertificateAuthorityContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11393,22 +19637,20 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) user_id: String, + pub(crate) gateway_id: String, + pub(crate) certificate_id: String, + pub(crate) parameters: models::GatewayCertificateAuthorityContract, 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/{}/groups/{}/users/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id, - &self.user_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_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); @@ -11419,7 +19661,11 @@ pub mod group_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + 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)?; @@ -11427,13 +19673,13 @@ pub mod group_user { 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::UserContract = + let rsp_value: models::GatewayCertificateAuthorityContract = 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::UserContract = + let rsp_value: models::GatewayCertificateAuthorityContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -11485,22 +19731,15 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) user_id: String, + pub(crate) gateway_id: String, + pub(crate) certificate_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/{}/groups/{}/users/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id, - &self.user_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_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); @@ -11511,6 +19750,7 @@ pub mod group_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + 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)?; @@ -11533,12 +19773,10 @@ pub mod group_user { } } } - pub mod check_entity_exists { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Error response #response_type")] - NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -11564,22 +19802,14 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) user_id: String, + pub(crate) gateway_id: String, + pub(crate) certificate_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/{}/groups/{}/users/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id, - &self.user_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_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); @@ -11596,8 +19826,7 @@ pub mod group_user { let 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(()), - http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + 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 = @@ -11613,7 +19842,7 @@ pub mod group_user { } } } -pub mod identity_provider { +pub mod group { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -11628,20 +19857,23 @@ pub mod identity_provider { 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, - identity_provider_name: impl Into, + group_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(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -11649,15 +19881,15 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, - parameters: impl Into, + group_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(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -11667,8 +19899,8 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, - parameters: impl Into, + group_id: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -11676,7 +19908,7 @@ pub mod identity_provider { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), @@ -11686,7 +19918,7 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, + group_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -11694,7 +19926,7 @@ pub mod identity_provider { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -11703,35 +19935,205 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, + group_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(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } - pub fn list_secrets( - &self, - resource_group_name: impl Into, - service_name: impl Into, - identity_provider_name: impl Into, - subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), - subscription_id: subscription_id.into(), + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/groups", + 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", "2021-08-01"); + 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::GroupCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) group_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/{}/groups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GroupContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_service { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::GroupContract), + Ok200(models::GroupContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -11759,21 +20161,29 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) group_id: String, + pub(crate) parameters: models::GroupCreateParameters, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/identityProviders", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11781,17 +20191,27 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; + 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::GroupContract = + 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::IdentityProviderList = + let rsp_value: models::GroupContract = 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)?; @@ -11807,7 +20227,7 @@ pub mod identity_provider { } } } - pub mod get { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11836,23 +20256,25 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, + pub(crate) group_id: String, + pub(crate) parameters: models::GroupUpdateParameters, + pub(crate) if_match: String, 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.ApiManagement/service/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11860,7 +20282,9 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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)?; @@ -11868,7 +20292,7 @@ pub mod identity_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IdentityProviderContract = + let rsp_value: models::GroupContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -11886,12 +20310,12 @@ pub mod identity_provider { } } } - pub mod create_or_update { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::IdentityProviderContract), - Ok200(models::IdentityProviderContract), + Ok200, + NoContent204, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11920,29 +20344,24 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, - pub(crate) parameters: models::IdentityProviderCreateContract, + pub(crate) group_id: String, + pub(crate) if_match: String, 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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.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::PUT); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11950,28 +20369,89 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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.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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IdentityProviderContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Created201(rsp_value)) - } - http::StatusCode::OK => { + 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::IdentityProviderContract = + let rsp_value: models::ErrorResponse = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) group_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/{}/groups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.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::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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 = @@ -11986,7 +20466,82 @@ pub mod identity_provider { } } } - pub mod update { +} +pub mod group_user { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn create( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + user_id: 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(), + group_id: group_id.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12015,25 +20570,38 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, - pub(crate) parameters: models::IdentityProviderUpdateParameters, - pub(crate) if_match: String, + pub(crate) group_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.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::PATCH); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12041,9 +20609,16 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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.header("If-Match", &self.if_match); + 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)?; @@ -12051,7 +20626,7 @@ pub mod identity_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IdentityProviderContract = + let rsp_value: models::UserCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -12069,12 +20644,12 @@ pub mod identity_provider { } } } - pub mod delete { + pub mod create { use super::models; #[derive(Debug)] pub enum Response { - Ok200, - NoContent204, + Created201(models::UserContract), + Ok200(models::UserContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12103,24 +20678,25 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, - pub(crate) if_match: String, + pub(crate) group_id: String, + pub(crate) user_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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.group_id, + &self.user_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12128,15 +20704,24 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UserContract = + 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::UserContract = + 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 = @@ -12151,8 +20736,13 @@ pub mod identity_provider { } } } - pub mod get_entity_tag { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12180,23 +20770,25 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, + pub(crate) group_id: String, + pub(crate) user_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.group_id, + &self.user_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12210,7 +20802,8 @@ pub mod identity_provider { let rsp = 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(()), + 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 = @@ -12225,10 +20818,12 @@ pub mod identity_provider { } } } - pub mod list_secrets { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -12254,16 +20849,25 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, + pub(crate) group_id: String, + pub(crate) user_id: String, 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<(), Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . identity_provider_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.group_id, + &self.user_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12272,18 +20876,13 @@ pub mod identity_provider { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); 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::ClientSecretContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + http::StatusCode::NO_CONTENT => Ok(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -12299,7 +20898,7 @@ pub mod identity_provider { } } } -pub mod issue { +pub mod identity_provider { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -12314,28 +20913,186 @@ pub mod issue { 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, - issue_id: impl Into, + identity_provider_name: 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(), - issue_id: issue_id.into(), + identity_provider_name: identity_provider_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + identity_provider_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(), + service_name: service_name.into(), + identity_provider_name: identity_provider_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + identity_provider_name: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + identity_provider_name: identity_provider_name.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + identity_provider_name: 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(), + identity_provider_name: identity_provider_name.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, + identity_provider_name: 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(), + identity_provider_name: identity_provider_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + identity_provider_name: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + identity_provider_name: identity_provider_name.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_service { + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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, + } + impl Builder { + 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/{}/identityProviders", + 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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IdentityProviderList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12364,32 +21121,19 @@ pub mod issue { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) identity_provider_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> { + 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/{}/issues", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.identity_provider_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -12401,15 +21145,6 @@ pub mod issue { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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)?; @@ -12418,7 +21153,7 @@ pub mod issue { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IssueCollection = + let rsp_value: models::IdentityProviderContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -12436,8 +21171,13 @@ pub mod issue { } } } - pub mod get { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::IdentityProviderContract), + Ok200(models::IdentityProviderContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12465,23 +21205,29 @@ pub mod issue { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) issue_id: String, + pub(crate) identity_provider_name: String, + pub(crate) parameters: models::IdentityProviderCreateContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/issues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.issue_id + &self.identity_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12489,17 +21235,27 @@ pub mod issue { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; + 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::IdentityProviderContract = + 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::IssueContract = + let rsp_value: models::IdentityProviderContract = 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)?; @@ -12515,113 +21271,7 @@ pub mod issue { } } } -} -pub mod logger { - use super::models; - 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, - logger_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(), - logger_id: logger_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - logger_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(), - logger_id: logger_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - logger_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - logger_id: logger_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - logger_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(), - logger_id: logger_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, - logger_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(), - logger_id: logger_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12650,36 +21300,25 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) identity_provider_name: String, + pub(crate) parameters: models::IdentityProviderUpdateParameters, + pub(crate) if_match: 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> { + 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/{}/loggers", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.identity_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12687,16 +21326,9 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.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)?; @@ -12704,7 +21336,7 @@ pub mod logger { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::LoggerCollection = + let rsp_value: models::IdentityProviderContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -12722,8 +21354,13 @@ pub mod logger { } } } - pub mod get { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12751,23 +21388,24 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, + pub(crate) identity_provider_name: 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> { + 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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.identity_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12775,18 +21413,15 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::LoggerContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -12801,13 +21436,8 @@ pub mod logger { } } } - pub mod create_or_update { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::LoggerContract), - Ok200(models::LoggerContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12835,29 +21465,23 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, - pub(crate) parameters: models::LoggerContract, + pub(crate) identity_provider_name: String, 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> { + 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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.identity_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12865,28 +21489,13 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::LoggerContract = - 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::LoggerContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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 = @@ -12901,7 +21510,7 @@ pub mod logger { } } } - pub mod update { + pub mod list_secrets { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12930,25 +21539,16 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, - pub(crate) parameters: models::LoggerUpdateContract, - pub(crate) if_match: String, + pub(crate) identity_provider_name: String, 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.ApiManagement/service/{}/loggers/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.logger_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . identity_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::PATCH); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12956,9 +21556,8 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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.header("If-Match", &self.if_match); + 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)?; @@ -12966,7 +21565,7 @@ pub mod logger { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::LoggerContract = + let rsp_value: models::ClientSecretContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -12984,13 +21583,45 @@ pub mod logger { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, +} +pub mod issue { + use super::models; + 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, + issue_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(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + } } + } + pub mod list_by_service { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13018,24 +21649,36 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, - pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/issues", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.logger_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13043,15 +21686,27 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - req_builder = req_builder.header("If-Match", &self.if_match); + 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 => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -13066,7 +21721,7 @@ pub mod logger { } } } - pub mod get_entity_tag { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13095,23 +21750,23 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, + pub(crate) issue_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/issues/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.issue_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13125,7 +21780,12 @@ pub mod logger { let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -13141,7 +21801,7 @@ pub mod logger { } } } -pub mod named_value { +pub mod logger { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -13159,21 +21819,20 @@ pub mod named_value { filter: None, top: None, skip: None, - is_key_vault_refresh_failed: None, } } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - named_value_id: impl Into, + logger_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(), - named_value_id: named_value_id.into(), + logger_id: logger_id.into(), subscription_id: subscription_id.into(), } } @@ -13181,15 +21840,15 @@ pub mod named_value { &self, resource_group_name: impl Into, service_name: impl Into, - named_value_id: impl Into, - parameters: impl Into, + logger_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(), - named_value_id: named_value_id.into(), + logger_id: logger_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -13199,8 +21858,8 @@ pub mod named_value { &self, resource_group_name: impl Into, service_name: impl Into, - named_value_id: impl Into, - parameters: impl Into, + logger_id: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -13208,71 +21867,41 @@ pub mod named_value { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - named_value_id: named_value_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - named_value_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(), - named_value_id: named_value_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, - named_value_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(), - named_value_id: named_value_id.into(), + logger_id: logger_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } - pub fn list_value( + pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - named_value_id: impl Into, + logger_id: impl Into, + if_match: impl Into, subscription_id: impl Into, - ) -> list_value::Builder { - list_value::Builder { + ) -> delete::Builder { + delete::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - named_value_id: named_value_id.into(), + logger_id: logger_id.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } - pub fn refresh_secret( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, - named_value_id: impl Into, + logger_id: impl Into, subscription_id: impl Into, - ) -> refresh_secret::Builder { - refresh_secret::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - named_value_id: named_value_id.into(), + logger_id: logger_id.into(), subscription_id: subscription_id.into(), } } @@ -13310,7 +21939,6 @@ pub mod named_value { pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, - pub(crate) is_key_vault_refresh_failed: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -13325,14 +21953,10 @@ pub mod named_value { self.skip = Some(skip); self } - pub fn is_key_vault_refresh_failed(mut self, is_key_vault_refresh_failed: bool) -> Self { - self.is_key_vault_refresh_failed = Some(is_key_vault_refresh_failed); - self - } - 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.ApiManagement/service/{}/namedValues", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -13357,10 +21981,6 @@ pub mod named_value { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } - if let Some(is_key_vault_refresh_failed) = &self.is_key_vault_refresh_failed { - url.query_pairs_mut() - .append_pair("isKeyVaultRefreshFailed", &is_key_vault_refresh_failed.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)?; @@ -13369,7 +21989,7 @@ pub mod named_value { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NamedValueCollection = + let rsp_value: models::LoggerCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -13416,19 +22036,19 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, + pub(crate) logger_id: String, 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.ApiManagement/service/{}/namedValues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.named_value_id + &self.logger_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -13448,7 +22068,7 @@ pub mod named_value { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NamedValueContract = + let rsp_value: models::LoggerContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -13470,9 +22090,8 @@ pub mod named_value { use super::models; #[derive(Debug)] pub enum Response { - Accepted202, - Created201(models::NamedValueContract), - Ok200(models::NamedValueContract), + Created201(models::LoggerContract), + Ok200(models::LoggerContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13501,8 +22120,8 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, - pub(crate) parameters: models::NamedValueCreateContract, + pub(crate) logger_id: String, + pub(crate) parameters: models::LoggerContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -13514,12 +22133,12 @@ pub mod named_value { 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/{}/namedValues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.named_value_id + &self.logger_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -13541,16 +22160,15 @@ pub mod named_value { let 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::CREATED => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NamedValueContract = + let rsp_value: models::LoggerContract = 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::NamedValueContract = + let rsp_value: models::LoggerContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -13570,11 +22188,6 @@ pub mod named_value { } pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Ok200(models::NamedValueContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13602,21 +22215,21 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, - pub(crate) parameters: models::NamedValueUpdateParameters, + pub(crate) logger_id: String, + pub(crate) parameters: models::LoggerUpdateContract, pub(crate) if_match: String, 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.ApiManagement/service/{}/namedValues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.named_value_id + &self.logger_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -13636,12 +22249,11 @@ pub mod named_value { let 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::NamedValueContract = + let rsp_value: models::LoggerContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -13691,7 +22303,7 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, + pub(crate) logger_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -13699,12 +22311,12 @@ pub mod named_value { 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/{}/namedValues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.named_value_id + &self.logger_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -13768,19 +22380,19 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, + pub(crate) logger_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/{}/namedValues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.named_value_id + &self.logger_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -13813,93 +22425,145 @@ pub mod named_value { } } } - pub mod list_value { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), +} +pub mod named_value { + use super::models; + 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, + is_key_vault_refresh_failed: None, + } } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) named_value_id: String, - pub(crate) subscription_id: String, + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_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(), + named_value_id: named_value_id.into(), + subscription_id: subscription_id.into(), + } } - impl Builder { - 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/{}/namedValues/{}/listValue", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.named_value_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", "2021-08-01"); - 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::NamedValueSecretContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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 create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_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(), + named_value_id: named_value_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + named_value_id: named_value_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_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(), + named_value_id: named_value_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, + named_value_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(), + named_value_id: named_value_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_value( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_id: impl Into, + subscription_id: impl Into, + ) -> list_value::Builder { + list_value::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + named_value_id: named_value_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn refresh_secret( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_id: impl Into, + subscription_id: impl Into, + ) -> refresh_secret::Builder { + refresh_secret::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + named_value_id: named_value_id.into(), + subscription_id: subscription_id.into(), } } } - pub mod refresh_secret { + pub mod list_by_service { use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Ok200(models::NamedValueContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13927,23 +22591,41 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) is_key_vault_refresh_failed: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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 is_key_vault_refresh_failed(mut self, is_key_vault_refresh_failed: bool) -> Self { + self.is_key_vault_refresh_failed = Some(is_key_vault_refresh_failed); + 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/{}/namedValues/{}/refreshSecret", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.named_value_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13951,19 +22633,30 @@ pub mod named_value { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + 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()); + } + if let Some(is_key_vault_refresh_failed) = &self.is_key_vault_refresh_failed { + url.query_pairs_mut() + .append_pair("isKeyVaultRefreshFailed", &is_key_vault_refresh_failed.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::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::NamedValueContract = + let rsp_value: models::NamedValueCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -13979,41 +22672,7 @@ pub mod named_value { } } } -} -pub mod network_status { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_service( - &self, - subscription_id: impl Into, - resource_group_name: impl Into, - service_name: impl Into, - ) -> list_by_service::Builder { - list_by_service::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_by_location( - &self, - subscription_id: impl Into, - resource_group_name: impl Into, - service_name: impl Into, - location_name: impl Into, - ) -> list_by_location::Builder { - list_by_location::Builder { - client: self.0.clone(), - subscription_id: subscription_id.into(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - location_name: location_name.into(), - } - } - } - pub mod list_by_service { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14040,21 +22699,21 @@ pub mod network_status { #[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) named_value_id: String, + pub(crate) subscription_id: String, } impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + 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/{}/networkstatus", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.named_value_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -14074,7 +22733,7 @@ pub mod network_status { 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 = + let rsp_value: models::NamedValueContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -14092,8 +22751,14 @@ pub mod network_status { } } } - pub mod list_by_location { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Created201(models::NamedValueContract), + Ok200(models::NamedValueContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -14119,25 +22784,31 @@ pub mod network_status { #[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) location_name: String, + pub(crate) named_value_id: String, + pub(crate) parameters: models::NamedValueCreateContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/locations/{}/networkstatus", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.location_name + &self.named_value_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14145,17 +22816,28 @@ pub mod network_status { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; + 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::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NamedValueContract = + 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::NetworkStatusContract = + let rsp_value: models::NamedValueContract = 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)?; @@ -14171,60 +22853,13 @@ pub mod network_status { } } } -} -pub mod notification { - use super::models; - 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(), - top: None, - skip: None, - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: 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(), - notification_name: notification_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_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(), - service_name: service_name.into(), - notification_name: notification_name.into(), - subscription_id: subscription_id.into(), - if_match: None, - } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::NamedValueContract), } - } - pub mod list_by_service { - use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -14252,31 +22887,25 @@ pub mod notification { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) named_value_id: String, + pub(crate) parameters: models::NamedValueUpdateParameters, + pub(crate) if_match: String, pub(crate) subscription_id: String, - pub(crate) top: Option, - pub(crate) skip: Option, } impl Builder { - 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> { + 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/{}/notifications", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.named_value_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14284,23 +22913,20 @@ pub mod notification { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.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::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::NotificationCollection = + let rsp_value: models::NamedValueContract = 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)?; @@ -14316,8 +22942,13 @@ pub mod notification { } } } - pub mod get { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -14345,23 +22976,24 @@ pub mod notification { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, + pub(crate) named_value_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> { + 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/{}/notifications/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.notification_name + &self.named_value_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14369,18 +23001,15 @@ pub mod notification { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NotificationContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -14395,7 +23024,7 @@ pub mod notification { } } } - pub mod create_or_update { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14424,28 +23053,23 @@ pub mod notification { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, + pub(crate) named_value_id: String, 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> { + 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/{}/notifications/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.notification_name + &self.named_value_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14453,21 +23077,13 @@ pub mod notification { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - if let Some(if_match) = &self.if_match { - req_builder = req_builder.header("If-Match", 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NotificationContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -14482,79 +23098,7 @@ pub mod notification { } } } -} -pub mod notification_recipient_user { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_notification( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - subscription_id: impl Into, - ) -> list_by_notification::Builder { - list_by_notification::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - notification_name: notification_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - user_id: 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(), - notification_name: notification_name.into(), - user_id: user_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - user_id: 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(), - notification_name: notification_name.into(), - user_id: user_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn check_entity_exists( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - user_id: impl Into, - subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - notification_name: notification_name.into(), - user_id: user_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_notification { + pub mod list_value { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14583,16 +23127,23 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, + pub(crate) named_value_id: String, 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.ApiManagement/service/{}/notifications/{}/recipientUsers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}/listValue", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14601,6 +23152,7 @@ pub mod notification_recipient_user { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); 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)?; @@ -14608,7 +23160,7 @@ pub mod notification_recipient_user { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientUserCollection = + let rsp_value: models::NamedValueSecretContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -14626,12 +23178,12 @@ pub mod notification_recipient_user { } } } - pub mod create_or_update { + pub mod refresh_secret { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::RecipientUserContract), - Ok200(models::RecipientUserContract), + Accepted202, + Ok200(models::NamedValueContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14660,17 +23212,23 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) user_id: String, + pub(crate) named_value_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/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}/refreshSecret", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14679,20 +23237,16 @@ pub mod notification_recipient_user { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientUserContract = - 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), http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientUserContract = + let rsp_value: models::NamedValueContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -14710,13 +23264,42 @@ pub mod notification_recipient_user { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, +} +pub mod network_status { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> list_by_service::Builder { + list_by_service::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_by_location( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + location_name: impl Into, + ) -> list_by_location::Builder { + list_by_location::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + location_name: location_name.into(), + } + } + } + pub mod list_by_service { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -14742,19 +23325,25 @@ pub mod notification_recipient_user { #[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) notification_name: String, - pub(crate) user_id: String, - 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, Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/networkstatus", + 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14768,8 +23357,12 @@ pub mod notification_recipient_user { let rsp = 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::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::ErrorResponse = @@ -14784,12 +23377,10 @@ pub mod notification_recipient_user { } } } - pub mod check_entity_exists { + pub mod list_by_location { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Error response #response_type")] - NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -14813,19 +23404,25 @@ pub mod notification_recipient_user { #[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) notification_name: String, - pub(crate) user_id: String, - pub(crate) subscription_id: String, + pub(crate) location_name: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/locations/{}/networkstatus", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.location_name + ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14839,8 +23436,12 @@ pub mod notification_recipient_user { let 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(()), - http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkStatusContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -14856,78 +23457,58 @@ pub mod notification_recipient_user { } } } -pub mod notification_recipient_email { +pub mod notification { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_notification( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - subscription_id: impl Into, - ) -> list_by_notification::Builder { - list_by_notification::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - notification_name: notification_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - notification_name: impl Into, - email: impl Into, subscription_id: impl Into, - ) -> create_or_update::Builder { - create_or_update::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - notification_name: notification_name.into(), - email: email.into(), subscription_id: subscription_id.into(), + top: None, + skip: None, } } - pub fn delete( + pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, notification_name: impl Into, - email: impl Into, subscription_id: impl Into, - ) -> delete::Builder { - delete::Builder { + ) -> get::Builder { + get::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), notification_name: notification_name.into(), - email: email.into(), subscription_id: subscription_id.into(), } } - pub fn check_entity_exists( + pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, notification_name: impl Into, - email: impl Into, subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { + ) -> create_or_update::Builder { + create_or_update::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), notification_name: notification_name.into(), - email: email.into(), subscription_id: subscription_id.into(), + if_match: None, } } } - pub mod list_by_notification { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14956,13 +23537,28 @@ pub mod notification_recipient_email { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/notifications/{}/recipientEmails" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications", + 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); @@ -14973,6 +23569,12 @@ pub mod notification_recipient_email { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + 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)?; @@ -14981,7 +23583,7 @@ pub mod notification_recipient_email { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientEmailCollection = + let rsp_value: models::NotificationCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -14999,13 +23601,8 @@ pub mod notification_recipient_email { } } } - pub mod create_or_update { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::RecipientEmailContract), - Ok200(models::RecipientEmailContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15034,16 +23631,22 @@ pub mod notification_recipient_email { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) notification_name: String, - pub(crate) email: String, 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.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.notification_name + ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15057,17 +23660,11 @@ pub mod notification_recipient_email { let 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::RecipientEmailContract = - 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::RecipientEmailContract = + let rsp_value: models::NotificationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -15083,13 +23680,8 @@ pub mod notification_recipient_email { } } } - pub mod delete { + pub mod create_or_update { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15118,87 +23710,27 @@ pub mod notification_recipient_email { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) notification_name: String, - pub(crate) email: String, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - 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/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; - let mut url = 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", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = 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 fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self } - } - } - pub mod check_entity_exists { - use super::models; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Error response #response_type")] - NotFound404 {}, - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, - #[error("Failed to parse request URL")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) notification_name: String, - pub(crate) email: String, - pub(crate) subscription_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.notification_name + ); let mut url = 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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15206,14 +23738,21 @@ pub mod notification_recipient_email { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", 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::NO_CONTENT => Ok(()), - http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NotificationContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -15229,38 +23768,22 @@ pub mod notification_recipient_email { } } } -pub mod open_id_connect_provider { +pub mod notification_recipient_user { use super::models; 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( + pub fn list_by_notification( &self, resource_group_name: impl Into, service_name: impl Into, - opid: impl Into, + notification_name: impl Into, subscription_id: impl Into, - ) -> get::Builder { - get::Builder { + ) -> list_by_notification::Builder { + list_by_notification::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - opid: opid.into(), + notification_name: notification_name.into(), subscription_id: subscription_id.into(), } } @@ -15268,36 +23791,16 @@ pub mod open_id_connect_provider { &self, resource_group_name: impl Into, service_name: impl Into, - opid: impl Into, - parameters: impl Into, + notification_name: impl Into, + user_id: 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(), - opid: opid.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - opid: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - opid: opid.into(), - parameters: parameters.into(), - if_match: if_match.into(), + notification_name: notification_name.into(), + user_id: user_id.into(), subscription_id: subscription_id.into(), } } @@ -15305,51 +23808,38 @@ pub mod open_id_connect_provider { &self, resource_group_name: impl Into, service_name: impl Into, - opid: impl Into, - if_match: impl Into, + notification_name: impl Into, + user_id: 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(), - opid: opid.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, - opid: 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(), - opid: opid.into(), + notification_name: notification_name.into(), + user_id: user_id.into(), subscription_id: subscription_id.into(), } } - pub fn list_secrets( + pub fn check_entity_exists( &self, resource_group_name: impl Into, service_name: impl Into, - opid: impl Into, + notification_name: impl Into, + user_id: impl Into, subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - opid: opid.into(), + notification_name: notification_name.into(), + user_id: user_id.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_service { + pub mod list_by_notification { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -15378,35 +23868,13 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) notification_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> { + 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/{}/openidConnectProviders", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::GET); @@ -15417,15 +23885,6 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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)?; @@ -15434,7 +23893,7 @@ pub mod open_id_connect_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OpenIdConnectProviderCollection = + let rsp_value: models::RecipientUserCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -15452,8 +23911,13 @@ pub mod open_id_connect_provider { } } } - pub mod get { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::RecipientUserContract), + Ok200(models::RecipientUserContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15481,25 +23945,17 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, + pub(crate) notification_name: String, + pub(crate) user_id: String, 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.ApiManagement/service/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15513,11 +23969,17 @@ pub mod open_id_connect_provider { let 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::RecipientUserContract = + 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::OpenidConnectProviderContract = + let rsp_value: models::RecipientUserContract = 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)?; @@ -15533,12 +23995,12 @@ pub mod open_id_connect_provider { } } } - pub mod create_or_update { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::OpenidConnectProviderContract), - Ok200(models::OpenidConnectProviderContract), + Ok200, + NoContent204, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -15567,29 +24029,17 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, - pub(crate) parameters: models::OpenidConnectProviderContract, + pub(crate) notification_name: String, + pub(crate) user_id: String, 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/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15597,28 +24047,14 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::OpenidConnectProviderContract = - 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::OpenidConnectProviderContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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 = @@ -15633,10 +24069,12 @@ pub mod open_id_connect_provider { } } } - pub mod update { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -15662,27 +24100,17 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, - pub(crate) parameters: models::OpenidConnectProviderUpdateContract, - pub(crate) if_match: String, + pub(crate) notification_name: String, + pub(crate) user_id: String, 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<(), Error>> { Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15690,20 +24118,14 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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.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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OpenidConnectProviderContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + http::StatusCode::NO_CONTENT => Ok(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -15718,13 +24140,80 @@ pub mod open_id_connect_provider { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, +} +pub mod notification_recipient_email { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_notification( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + subscription_id: impl Into, + ) -> list_by_notification::Builder { + list_by_notification::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + email: 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(), + notification_name: notification_name.into(), + email: email.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + email: 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(), + notification_name: notification_name.into(), + email: email.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + email: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + email: email.into(), + subscription_id: subscription_id.into(), + } } + } + pub mod list_by_notification { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15752,24 +24241,16 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, - pub(crate) if_match: String, + pub(crate) notification_name: String, 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.ApiManagement/service/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15777,15 +24258,18 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecipientEmailCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -15800,8 +24284,13 @@ pub mod open_id_connect_provider { } } } - pub mod get_entity_tag { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::RecipientEmailContract), + Ok200(models::RecipientEmailContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15829,23 +24318,17 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, + pub(crate) notification_name: String, + pub(crate) email: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; let mut url = 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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15859,7 +24342,18 @@ pub mod open_id_connect_provider { let rsp = 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(()), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecipientEmailContract = + 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::RecipientEmailContract = + 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 = @@ -15874,8 +24368,13 @@ pub mod open_id_connect_provider { } } } - pub mod list_secrets { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15903,16 +24402,17 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, + pub(crate) notification_name: String, + pub(crate) email: String, 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.ApiManagement/service/{}/openidConnectProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . opid) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15921,18 +24421,13 @@ pub mod open_id_connect_provider { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); 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::ClientSecretContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -15947,29 +24442,12 @@ pub mod open_id_connect_provider { } } } -} -pub mod outbound_network_dependencies_endpoints { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_service( - &self, - subscription_id: impl Into, - resource_group_name: impl Into, - service_name: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { - client: self.0.clone(), - subscription_id: subscription_id.into(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - } - } - } - pub mod list_by_service { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -15993,19 +24471,19 @@ pub mod outbound_network_dependencies_endpoints { #[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) notification_name: String, + pub(crate) email: String, + 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<(), Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/outboundNetworkDependenciesEndpoints" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16019,12 +24497,8 @@ pub mod outbound_network_dependencies_endpoints { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OutboundEnvironmentEndpointList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + http::StatusCode::NO_CONTENT => Ok(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -16040,7 +24514,7 @@ pub mod outbound_network_dependencies_endpoints { } } } -pub mod policy { +pub mod open_id_connect_provider { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -16055,47 +24529,68 @@ pub mod policy { 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, - policy_id: impl Into, + opid: 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(), - policy_id: policy_id.into(), + opid: opid.into(), subscription_id: subscription_id.into(), - format: None, } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, - parameters: impl Into, + opid: 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(), - policy_id: policy_id.into(), + opid: opid.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, } } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + opid: opid.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, + opid: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -16103,7 +24598,7 @@ pub mod policy { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - policy_id: policy_id.into(), + opid: opid.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -16112,14 +24607,29 @@ pub mod policy { &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, + opid: 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(), - policy_id: policy_id.into(), + opid: opid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + opid: opid.into(), subscription_id: subscription_id.into(), } } @@ -16154,12 +24664,29 @@ pub mod policy { 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 into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/policies", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -16175,6 +24702,15 @@ pub mod policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + 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)?; @@ -16183,7 +24719,7 @@ pub mod policy { match 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 = + let rsp_value: models::OpenIdConnectProviderCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -16230,24 +24766,21 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, + pub(crate) opid: String, pub(crate) subscription_id: String, - pub(crate) format: Option, } impl Builder { - pub fn format(mut self, format: impl Into) -> Self { - self.format = Some(format.into()); - self - } - 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.ApiManagement/service/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.policy_id + &self.opid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -16259,9 +24792,6 @@ pub mod policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - if let Some(format) = &self.format { - url.query_pairs_mut().append_pair("format", format); - } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -16270,7 +24800,7 @@ pub mod policy { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PolicyContract = + let rsp_value: models::OpenidConnectProviderContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -16292,8 +24822,8 @@ pub mod policy { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::PolicyContract), - Ok200(models::PolicyContract), + Created201(models::OpenidConnectProviderContract), + Ok200(models::OpenidConnectProviderContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -16322,8 +24852,8 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, - pub(crate) parameters: models::PolicyContract, + pub(crate) opid: String, + pub(crate) parameters: models::OpenidConnectProviderContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -16335,12 +24865,12 @@ pub mod policy { 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/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.policy_id + &self.opid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -16364,13 +24894,13 @@ pub mod policy { 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::PolicyContract = + let rsp_value: models::OpenidConnectProviderContract = 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::PolicyContract = + let rsp_value: models::OpenidConnectProviderContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -16388,6 +24918,91 @@ pub mod policy { } } } + pub mod update { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) opid: String, + pub(crate) parameters: models::OpenidConnectProviderUpdateContract, + 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/{}/openidConnectProviders/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.opid + ); + let mut url = 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", "2021-08-01"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenidConnectProviderContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; #[derive(Debug)] @@ -16422,7 +25037,7 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, + pub(crate) opid: String, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -16430,12 +25045,12 @@ pub mod policy { 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/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.policy_id + &self.opid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -16499,19 +25114,19 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, + pub(crate) opid: 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/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.policy_id + &self.opid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -16544,23 +25159,95 @@ pub mod policy { } } } + pub mod list_secrets { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) opid: 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/{}/openidConnectProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . opid) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + 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::ClientSecretContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 policy_description { +pub mod outbound_network_dependencies_endpoints { use super::models; pub struct Client(pub(crate) super::Client); impl Client { pub fn list_by_service( &self, + subscription_id: impl Into, 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(), + subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - subscription_id: subscription_id.into(), - scope: None, } } } @@ -16591,27 +25278,16 @@ pub mod policy_description { #[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) subscription_id: String, - pub(crate) scope: Option, } impl Builder { - pub fn scope(mut self, scope: impl Into) -> Self { - self.scope = Some(scope.into()); - self - } pub fn into_future( self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + ) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policyDescriptions", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/outboundNetworkDependenciesEndpoints" , 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); @@ -16622,9 +25298,6 @@ pub mod policy_description { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - if let Some(scope) = &self.scope { - url.query_pairs_mut().append_pair("scope", scope); - } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -16633,7 +25306,7 @@ pub mod policy_description { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PolicyDescriptionCollection = + let rsp_value: models::OutboundEnvironmentEndpointList = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -16652,7 +25325,7 @@ pub mod policy_description { } } } -pub mod portal_revision { +pub mod policy { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -16667,58 +25340,55 @@ pub mod portal_revision { 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, - portal_revision_id: impl Into, + policy_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(), - portal_revision_id: portal_revision_id.into(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), + format: None, } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - portal_revision_id: impl Into, - parameters: impl Into, + policy_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(), - portal_revision_id: portal_revision_id.into(), + policy_id: policy_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), + if_match: None, } } - pub fn update( + pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - portal_revision_id: impl Into, - parameters: impl Into, + policy_id: impl Into, if_match: impl Into, subscription_id: impl Into, - ) -> update::Builder { - update::Builder { + ) -> delete::Builder { + delete::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - portal_revision_id: portal_revision_id.into(), - parameters: parameters.into(), + policy_id: policy_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -16727,14 +25397,14 @@ pub mod portal_revision { &self, resource_group_name: impl Into, service_name: impl Into, - portal_revision_id: impl Into, + policy_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(), - portal_revision_id: portal_revision_id.into(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), } } @@ -16769,208 +25439,20 @@ pub mod portal_revision { 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/{}/portalRevisions", - 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", "2021-08-01"); - 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::PortalRevisionCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) portal_revision_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/{}/portalRevisions/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.portal_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", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalRevisionContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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; - #[derive(Debug)] - pub enum Response { - Accepted202, - Created201(models::PortalRevisionContract), - } - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) portal_revision_id: String, - pub(crate) parameters: models::PortalRevisionContract, - 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.ApiManagement/service/{}/portalRevisions/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.portal_revision_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16978,19 +25460,17 @@ pub mod portal_revision { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::CREATED => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalRevisionContract = + let rsp_value: models::PolicyCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Created201(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -17006,13 +25486,8 @@ pub mod portal_revision { } } } - pub mod update { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Ok200(models::PortalRevisionContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -17040,25 +25515,28 @@ pub mod portal_revision { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) portal_revision_id: String, - pub(crate) parameters: models::PortalRevisionContract, - pub(crate) if_match: String, + pub(crate) policy_id: String, pub(crate) subscription_id: String, + pub(crate) format: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.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/{}/portalRevisions/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.portal_revision_id + &self.policy_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17066,20 +25544,20 @@ pub mod portal_revision { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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.header("If-Match", &self.if_match); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::PortalRevisionContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -17095,8 +25573,13 @@ pub mod portal_revision { } } } - pub mod get_entity_tag { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -17124,23 +25607,29 @@ pub mod portal_revision { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) portal_revision_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/portalRevisions/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.portal_revision_id + &self.policy_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17148,13 +25637,28 @@ pub mod portal_revision { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(()), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + 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::PolicyContract = + 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 = @@ -17169,27 +25673,13 @@ pub mod portal_revision { } } } -} -pub mod portal_settings { - use super::models; - 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(), - } - } - } - pub mod list_by_service { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -17217,21 +25707,24 @@ pub mod portal_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) policy_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> { + 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/{}/portalsettings", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17239,18 +25732,15 @@ pub mod portal_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSettingsCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -17265,72 +25755,7 @@ pub mod portal_settings { } } } -} -pub mod sign_in_settings { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - resource_group_name: impl Into, - service_name: 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(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - 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(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - parameters: parameters.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, - 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(), - subscription_id: subscription_id.into(), - } - } - } - pub mod get { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17359,21 +25784,23 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) policy_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17387,12 +25814,7 @@ pub mod sign_in_settings { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSigninSettings = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -17407,7 +25829,27 @@ pub mod sign_in_settings { } } } - pub mod create_or_update { +} +pub mod policy_description { + use super::models; + 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(), + scope: None, + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17436,19 +25878,20 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSigninSettings, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) scope: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + pub fn scope(mut self, scope: impl Into) -> Self { + self.scope = Some(scope.into()); self } - 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.ApiManagement/service/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policyDescriptions", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -17456,7 +25899,7 @@ pub mod sign_in_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17464,11 +25907,10 @@ pub mod sign_in_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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); + if let Some(scope) = &self.scope { + url.query_pairs_mut().append_pair("scope", scope); } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -17476,7 +25918,7 @@ pub mod sign_in_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSigninSettings = + let rsp_value: models::PolicyDescriptionCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -17494,7 +25936,95 @@ pub mod sign_in_settings { } } } - pub mod update { +} +pub mod portal_revision { + use super::models; + 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, + portal_revision_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(), + portal_revision_id: portal_revision_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + portal_revision_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(), + portal_revision_id: portal_revision_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + portal_revision_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + portal_revision_id: portal_revision_id.into(), + parameters: parameters.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, + portal_revision_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(), + portal_revision_id: portal_revision_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17523,15 +26053,28 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSigninSettings, - pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -17539,7 +26082,7 @@ pub mod sign_in_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17547,15 +26090,27 @@ pub mod sign_in_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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.header("If-Match", &self.if_match); + 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::NO_CONTENT => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalRevisionCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -17570,7 +26125,7 @@ pub mod sign_in_settings { } } } - pub mod get_entity_tag { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17599,21 +26154,23 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) portal_revision_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.portal_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::HEAD); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17627,7 +26184,12 @@ pub mod sign_in_settings { let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalRevisionContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -17642,73 +26204,13 @@ pub mod sign_in_settings { } } } -} -pub mod sign_up_settings { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - resource_group_name: impl Into, - service_name: 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(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - 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(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - parameters: parameters.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, - 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(), - subscription_id: subscription_id.into(), - } - } - } - pub mod get { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Created201(models::PortalRevisionContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -17736,21 +26238,24 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) portal_revision_id: String, + pub(crate) parameters: models::PortalRevisionContract, 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.ApiManagement/service/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.portal_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17758,17 +26263,19 @@ pub mod sign_up_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; + 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 => { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::CREATED => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSignupSettings = + let rsp_value: models::PortalRevisionContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + Ok(Response::Created201(rsp_value)) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -17784,8 +26291,13 @@ pub mod sign_up_settings { } } } - pub mod create_or_update { + pub mod update { use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::PortalRevisionContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -17813,27 +26325,25 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSignupSettings, + pub(crate) portal_revision_id: String, + pub(crate) parameters: models::PortalRevisionContract, + pub(crate) if_match: String, 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> { + 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/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.portal_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::PUT); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17843,19 +26353,18 @@ pub mod sign_up_settings { url.query_pairs_mut().append_pair("api-version", "2021-08-01"); 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.header("If-Match", &self.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::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::PortalSignupSettings = + let rsp_value: models::PortalRevisionContract = 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)?; @@ -17871,7 +26380,7 @@ pub mod sign_up_settings { } } } - pub mod update { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17900,23 +26409,23 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSignupSettings, - pub(crate) if_match: String, + pub(crate) portal_revision_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/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.portal_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::PATCH); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17924,15 +26433,13 @@ pub mod sign_up_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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.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::NO_CONTENT => Ok(()), + 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 = @@ -17947,7 +26454,26 @@ pub mod sign_up_settings { } } } - pub mod get_entity_tag { +} +pub mod portal_settings { + use super::models; + 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(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17979,10 +26505,10 @@ pub mod sign_up_settings { pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -17990,7 +26516,7 @@ pub mod sign_up_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18004,7 +26530,12 @@ pub mod sign_up_settings { let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalSettingsCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -18020,7 +26551,7 @@ pub mod sign_up_settings { } } } -pub mod delegation_settings { +pub mod sign_in_settings { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -18041,7 +26572,7 @@ pub mod delegation_settings { &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + parameters: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -18057,7 +26588,7 @@ pub mod delegation_settings { &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -18083,19 +26614,6 @@ pub mod delegation_settings { subscription_id: subscription_id.into(), } } - pub fn list_secrets( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - subscription_id: subscription_id.into(), - } - } } pub mod get { use super::models; @@ -18129,10 +26647,10 @@ pub mod delegation_settings { 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.ApiManagement/service/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -18156,7 +26674,7 @@ pub mod delegation_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalDelegationSettings = + let rsp_value: models::PortalSigninSettings = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -18203,7 +26721,7 @@ pub mod delegation_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalDelegationSettings, + pub(crate) parameters: models::PortalSigninSettings, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -18212,10 +26730,10 @@ pub mod delegation_settings { self.if_match = Some(if_match.into()); self } - 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.ApiManagement/service/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -18243,7 +26761,7 @@ pub mod delegation_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalDelegationSettings = + let rsp_value: models::PortalSigninSettings = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -18290,7 +26808,7 @@ pub mod delegation_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalDelegationSettings, + pub(crate) parameters: models::PortalSigninSettings, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -18298,7 +26816,7 @@ pub mod delegation_settings { 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/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -18337,7 +26855,144 @@ pub mod delegation_settings { } } } - pub mod get_entity_tag { + pub mod get_entity_tag { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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, + } + 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/{}/portalsettings/signin", + 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::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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 sign_up_settings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + service_name: 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(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + 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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.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, + 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(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18369,10 +27024,10 @@ pub mod delegation_settings { pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -18380,7 +27035,7 @@ pub mod delegation_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18394,7 +27049,12 @@ pub mod delegation_settings { let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalSignupSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -18409,7 +27069,7 @@ pub mod delegation_settings { } } } - pub mod list_secrets { + pub mod create_or_update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18438,17 +27098,27 @@ pub mod delegation_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) parameters: models::PortalSignupSettings, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/portalsettings/delegation/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", + 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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18456,8 +27126,11 @@ pub mod delegation_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + 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)?; @@ -18465,7 +27138,7 @@ pub mod delegation_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSettingValidationKeyContract = + let rsp_value: models::PortalSignupSettings = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -18483,101 +27156,7 @@ pub mod delegation_settings { } } } -} -pub mod private_endpoint_connection { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_service( - &self, - subscription_id: impl Into, - resource_group_name: impl Into, - service_name: impl Into, - ) -> list_by_service::Builder { - list_by_service::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_by_name( - &self, - resource_group_name: impl Into, - service_name: impl Into, - private_endpoint_connection_name: impl Into, - subscription_id: impl Into, - ) -> get_by_name::Builder { - get_by_name::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - private_endpoint_connection_name: private_endpoint_connection_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - private_endpoint_connection_name: impl Into, - subscription_id: impl Into, - private_endpoint_connection_request: 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(), - private_endpoint_connection_name: private_endpoint_connection_name.into(), - subscription_id: subscription_id.into(), - private_endpoint_connection_request: private_endpoint_connection_request.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - private_endpoint_connection_name: 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(), - private_endpoint_connection_name: private_endpoint_connection_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_private_link_resources( - &self, - resource_group_name: impl Into, - subscription_id: impl Into, - service_name: impl Into, - ) -> list_private_link_resources::Builder { - list_private_link_resources::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - service_name: service_name.into(), - } - } - pub fn get_private_link_resource( - &self, - resource_group_name: impl Into, - subscription_id: impl Into, - service_name: impl Into, - private_link_sub_resource_name: impl Into, - ) -> get_private_link_resource::Builder { - get_private_link_resource::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - service_name: service_name.into(), - private_link_sub_resource_name: private_link_sub_resource_name.into(), - } - } - } - pub mod list_by_service { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18604,17 +27183,17 @@ pub mod private_endpoint_connection { #[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) parameters: models::PortalSignupSettings, + pub(crate) if_match: String, + 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/privateEndpointConnections", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -18622,7 +27201,7 @@ pub mod private_endpoint_connection { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18630,18 +27209,15 @@ pub mod private_endpoint_connection { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::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) - } + 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::ErrorResponse = @@ -18656,7 +27232,7 @@ pub mod private_endpoint_connection { } } } - pub mod get_by_name { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18685,23 +27261,21 @@ pub mod private_endpoint_connection { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_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> { + 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/{}/privateEndpointConnections/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.private_endpoint_connection_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18715,12 +27289,7 @@ pub mod private_endpoint_connection { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match 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) - } + 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 = @@ -18735,13 +27304,86 @@ pub mod private_endpoint_connection { } } } - pub mod create_or_update { +} +pub mod delegation_settings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + service_name: 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(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + 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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.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, + 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(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Ok200(models::PrivateEndpointConnection), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -18769,24 +27411,21 @@ pub mod private_endpoint_connection { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) private_endpoint_connection_name: String, pub(crate) subscription_id: String, - pub(crate) private_endpoint_connection_request: models::PrivateEndpointConnectionRequest, } 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.ApiManagement/service/{}/privateEndpointConnections/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.private_endpoint_connection_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18794,19 +27433,17 @@ pub mod private_endpoint_connection { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.private_endpoint_connection_request).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::PrivateEndpointConnection = + let rsp_value: models::PortalDelegationSettings = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -18822,14 +27459,8 @@ pub mod private_endpoint_connection { } } } - pub mod delete { + pub mod create_or_update { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -18857,23 +27488,27 @@ pub mod private_endpoint_connection { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) private_endpoint_connection_name: String, + pub(crate) parameters: models::PortalDelegationSettings, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/privateEndpointConnections/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.private_endpoint_connection_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18881,15 +27516,22 @@ pub mod private_endpoint_connection { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalDelegationSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -18904,7 +27546,7 @@ pub mod private_endpoint_connection { } } } - pub mod list_private_link_resources { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18932,16 +27574,16 @@ pub mod private_endpoint_connection { pub struct Builder { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, pub(crate) service_name: String, + pub(crate) parameters: models::PortalDelegationSettings, + pub(crate) if_match: String, + 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/privateLinkResources", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -18949,7 +27591,7 @@ pub mod private_endpoint_connection { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18957,18 +27599,15 @@ pub mod private_endpoint_connection { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::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) - } + 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::ErrorResponse = @@ -18983,7 +27622,7 @@ pub mod private_endpoint_connection { } } } - pub mod get_private_link_resource { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -19011,24 +27650,22 @@ pub mod private_endpoint_connection { pub struct Builder { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, pub(crate) service_name: String, - pub(crate) private_link_sub_resource_name: String, + 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/privateLinkResources/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.private_link_sub_resource_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -19042,153 +27679,22 @@ pub mod private_endpoint_connection { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match 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) - } + 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 product { - use super::models; - 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, - expand_groups: None, - tags: None, - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_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(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_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(), - product_id: product_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_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(), - product_id: product_id.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - delete_subscriptions: None, - } - } - pub fn get_entity_tag( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_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(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_by_tags( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> list_by_tags::Builder { - list_by_tags::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, - include_not_tagged_products: None, + 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_service { + pub mod list_secrets { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -19218,45 +27724,16 @@ pub mod product { 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, - pub(crate) expand_groups: Option, - pub(crate) tags: 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 expand_groups(mut self, expand_groups: bool) -> Self { - self.expand_groups = Some(expand_groups); - self - } - pub fn tags(mut self, tags: impl Into) -> Self { - self.tags = Some(tags.into()); - self - } - 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.ApiManagement/service/{}/products", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation/listSecrets" , 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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -19264,22 +27741,8 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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()); - } - if let Some(expand_groups) = &self.expand_groups { - url.query_pairs_mut().append_pair("expandGroups", &expand_groups.to_string()); - } - if let Some(tags) = &self.tags { - url.query_pairs_mut().append_pair("tags", tags); - } 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)?; @@ -19287,7 +27750,7 @@ pub mod product { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProductCollection = + let rsp_value: models::PortalSettingValidationKeyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -19305,7 +27768,101 @@ pub mod product { } } } - pub mod get { +} +pub mod private_endpoint_connection { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> list_by_service::Builder { + list_by_service::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_by_name( + &self, + resource_group_name: impl Into, + service_name: impl Into, + private_endpoint_connection_name: impl Into, + subscription_id: impl Into, + ) -> get_by_name::Builder { + get_by_name::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + private_endpoint_connection_name: impl Into, + subscription_id: impl Into, + private_endpoint_connection_request: 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(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + subscription_id: subscription_id.into(), + private_endpoint_connection_request: private_endpoint_connection_request.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + private_endpoint_connection_name: 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(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_private_link_resources( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + service_name: impl Into, + ) -> list_private_link_resources::Builder { + list_private_link_resources::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + service_name: service_name.into(), + } + } + pub fn get_private_link_resource( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + service_name: impl Into, + private_link_sub_resource_name: impl Into, + ) -> get_private_link_resource::Builder { + get_private_link_resource::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + service_name: service_name.into(), + private_link_sub_resource_name: private_link_sub_resource_name.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -19332,21 +27889,21 @@ pub mod product { #[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) product_id: String, - 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.ApiManagement/service/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/privateEndpointConnections", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &self.service_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -19366,7 +27923,7 @@ pub mod product { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProductContract = + let rsp_value: models::PrivateEndpointConnectionListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -19384,13 +27941,8 @@ pub mod product { } } } - pub mod create_or_update { + pub mod get_by_name { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ProductContract), - Ok200(models::ProductContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -19418,29 +27970,23 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) parameters: models::ProductContract, + pub(crate) private_endpoint_connection_name: String, 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> { + 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/privateEndpointConnections/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -19448,27 +27994,17 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ProductContract = - 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::ProductContract = + 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)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -19484,8 +28020,13 @@ pub mod product { } } } - pub mod update { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::PrivateEndpointConnection), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -19513,25 +28054,24 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) parameters: models::ProductUpdateParameters, - pub(crate) if_match: String, + pub(crate) private_endpoint_connection_name: String, pub(crate) subscription_id: String, + pub(crate) private_endpoint_connection_request: models::PrivateEndpointConnectionRequest, } 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.ApiManagement/service/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/privateEndpointConnections/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id + &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::PATCH); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -19540,18 +28080,18 @@ pub mod product { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); 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.header("If-Match", &self.if_match); + let req_body = azure_core::to_json(&self.private_endpoint_connection_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::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::ProductContract = + let rsp_value: models::PrivateEndpointConnection = 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)?; @@ -19572,6 +28112,7 @@ pub mod product { #[derive(Debug)] pub enum Response { Ok200, + Accepted202, NoContent204, } #[derive(Debug, thiserror :: Error)] @@ -19601,25 +28142,19 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) if_match: String, + pub(crate) private_endpoint_connection_name: String, pub(crate) subscription_id: String, - pub(crate) delete_subscriptions: Option, - } - impl Builder { - pub fn delete_subscriptions(mut self, delete_subscriptions: bool) -> Self { - self.delete_subscriptions = Some(delete_subscriptions); - self - } + } + impl Builder { 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/privateEndpointConnections/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id + &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(); @@ -19631,11 +28166,6 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - req_builder = req_builder.header("If-Match", &self.if_match); - if let Some(delete_subscriptions) = &self.delete_subscriptions { - url.query_pairs_mut() - .append_pair("deleteSubscriptions", &delete_subscriptions.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)?; @@ -19643,6 +28173,7 @@ pub mod product { 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)?; @@ -19658,7 +28189,7 @@ pub mod product { } } } - pub mod get_entity_tag { + pub mod list_private_link_resources { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -19686,24 +28217,24 @@ pub mod product { pub struct Builder { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) product_id: String, pub(crate) subscription_id: String, + pub(crate) service_name: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/privateLinkResources", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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::HEAD); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -19717,7 +28248,12 @@ pub mod product { let rsp = 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(()), + 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 = @@ -19732,7 +28268,7 @@ pub mod product { } } } - pub mod list_by_tags { + pub mod get_private_link_resource { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -19760,38 +28296,20 @@ pub mod product { 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, - pub(crate) include_not_tagged_products: Option, + pub(crate) service_name: String, + pub(crate) private_link_sub_resource_name: String, } 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 include_not_tagged_products(mut self, include_not_tagged_products: bool) -> Self { - self.include_not_tagged_products = Some(include_not_tagged_products); - self - } - 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.ApiManagement/service/{}/productsByTags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/privateLinkResources/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.private_link_sub_resource_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -19803,19 +28321,6 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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()); - } - if let Some(include_not_tagged_products) = &self.include_not_tagged_products { - url.query_pairs_mut() - .append_pair("includeNotTaggedProducts", &include_not_tagged_products.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)?; @@ -19824,7 +28329,7 @@ pub mod product { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagResourceCollection = + let rsp_value: models::PrivateLinkResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -19843,26 +28348,41 @@ pub mod product { } } } -pub mod product_api { +pub mod product { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_product( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - product_id: impl Into, subscription_id: impl Into, - ) -> list_by_product::Builder { - list_by_product::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - product_id: product_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, + expand_groups: None, + tags: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_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(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), } } pub fn create_or_update( @@ -19870,7 +28390,7 @@ pub mod product_api { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - api_id: impl Into, + parameters: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -19878,7 +28398,27 @@ pub mod product_api { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - api_id: api_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } @@ -19887,7 +28427,7 @@ pub mod product_api { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - api_id: impl Into, + if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { delete::Builder { @@ -19895,138 +28435,46 @@ pub mod product_api { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - api_id: api_id.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), + delete_subscriptions: None, } } - pub fn check_entity_exists( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - api_id: impl Into, subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - api_id: api_id.into(), subscription_id: subscription_id.into(), } } - } - pub mod list_by_product { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: 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/{}/products/{}/apis", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_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", "2021-08-01"); - 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::ApiCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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 list_by_tags( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_tags::Builder { + list_by_tags::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, + include_not_tagged_products: None, } } } - pub mod create_or_update { + pub mod list_by_service { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ApiContract), - Ok200(models::ApiContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -20054,25 +28502,46 @@ pub mod product_api { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) api_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) expand_groups: Option, + pub(crate) tags: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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 expand_groups(mut self, expand_groups: bool) -> Self { + self.expand_groups = Some(expand_groups); + self + } + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.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/{}/products/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.api_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -20080,106 +28549,33 @@ pub mod product_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + 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()); + } + if let Some(expand_groups) = &self.expand_groups { + url.query_pairs_mut().append_pair("expandGroups", &expand_groups.to_string()); + } + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ApiContract = - 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::ApiContract = - 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 = + let rsp_value: models::ProductCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) + Ok(rsp_value) } - } - }) - } - } - } - pub mod delete { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: String, - pub(crate) api_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/{}/products/{}/apis/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.api_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", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = 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 = @@ -20194,7 +28590,7 @@ pub mod product_api { } } } - pub mod check_entity_exists { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -20224,24 +28620,22 @@ pub mod product_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) api_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/products/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.api_id + &self.product_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -20255,98 +28649,33 @@ pub mod product_api { let 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 => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ErrorResponse = + let rsp_value: models::ProductContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) + Ok(rsp_value) } - } - }) - } - } - } -} -pub mod product_group { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - subscription_id: impl Into, - ) -> list_by_product::Builder { - list_by_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - group_id: 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(), - product_id: product_id.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - group_id: 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(), - product_id: product_id.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn check_entity_exists( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - group_id: impl Into, - subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), + 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_product { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ProductContract), + Ok200(models::ProductContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -20375,28 +28704,19 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, + pub(crate) parameters: models::ProductContract, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, + pub(crate) if_match: 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); + 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> { + 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/{}/products/{}/groups", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -20405,7 +28725,7 @@ pub mod product_group { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -20413,26 +28733,27 @@ pub mod product_group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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()); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ProductContract = + 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::GroupCollection = + let rsp_value: models::ProductContract = 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)?; @@ -20448,13 +28769,8 @@ pub mod product_group { } } } - pub mod create_or_update { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::GroupContract), - Ok200(models::GroupContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -20483,24 +28799,24 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) group_id: String, + pub(crate) parameters: models::ProductUpdateParameters, + pub(crate) if_match: String, 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.ApiManagement/service/{}/products/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.group_id + &self.product_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -20508,23 +28824,19 @@ pub mod product_group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::GroupContract = - 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::GroupContract = + let rsp_value: models::ProductContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -20575,20 +28887,24 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) group_id: String, + pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) delete_subscriptions: Option, } impl Builder { + pub fn delete_subscriptions(mut self, delete_subscriptions: bool) -> Self { + self.delete_subscriptions = Some(delete_subscriptions); + 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/{}/products/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.group_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -20600,6 +28916,11 @@ pub mod product_group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("If-Match", &self.if_match); + if let Some(delete_subscriptions) = &self.delete_subscriptions { + url.query_pairs_mut() + .append_pair("deleteSubscriptions", &delete_subscriptions.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)?; @@ -20622,7 +28943,7 @@ pub mod product_group { } } } - pub mod check_entity_exists { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -20652,20 +28973,18 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) group_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/{}/products/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.group_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -20683,7 +29002,7 @@ pub mod product_group { let 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(()), + 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 = @@ -20698,31 +29017,7 @@ pub mod product_group { } } } -} -pub mod product_subscriptions { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - } - pub mod list { + pub mod list_by_tags { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -20751,11 +29046,11 @@ pub mod product_subscriptions { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, + pub(crate) include_not_tagged_products: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -20770,15 +29065,18 @@ pub mod product_subscriptions { self.skip = Some(skip); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn include_not_tagged_products(mut self, include_not_tagged_products: bool) -> Self { + self.include_not_tagged_products = Some(include_not_tagged_products); + 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/{}/products/{}/subscriptions", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/productsByTags", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &self.service_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -20799,6 +29097,10 @@ pub mod product_subscriptions { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } + if let Some(include_not_tagged_products) = &self.include_not_tagged_products { + url.query_pairs_mut() + .append_pair("includeNotTaggedProducts", &include_not_tagged_products.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)?; @@ -20807,7 +29109,7 @@ pub mod product_subscriptions { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::SubscriptionCollection = + let rsp_value: models::TagResourceCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -20826,7 +29128,7 @@ pub mod product_subscriptions { } } } -pub mod product_policy { +pub mod product_api { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -20843,24 +29145,9 @@ pub mod product_policy { service_name: service_name.into(), product_id: product_id.into(), subscription_id: subscription_id.into(), - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - policy_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(), - product_id: product_id.into(), - policy_id: policy_id.into(), - subscription_id: subscription_id.into(), - format: None, + filter: None, + top: None, + skip: None, } } pub fn create_or_update( @@ -20868,8 +29155,7 @@ pub mod product_policy { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - policy_id: impl Into, - parameters: impl Into, + api_id: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -20877,10 +29163,8 @@ pub mod product_policy { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - policy_id: policy_id.into(), - parameters: parameters.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), - if_match: None, } } pub fn delete( @@ -20888,8 +29172,7 @@ pub mod product_policy { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - policy_id: impl Into, - if_match: impl Into, + api_id: impl Into, subscription_id: impl Into, ) -> delete::Builder { delete::Builder { @@ -20897,109 +29180,29 @@ pub mod product_policy { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - policy_id: policy_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, - product_id: impl Into, - policy_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(), - product_id: product_id.into(), - policy_id: policy_id.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_product { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_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/{}/products/{}/policies", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_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", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match 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)?; - 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 check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), } } } - pub mod get { + pub mod list_by_product { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -21029,25 +29232,33 @@ pub mod product_policy { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) policy_id: String, pub(crate) subscription_id: String, - pub(crate) format: Option, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn format(mut self, format: impl Into) -> Self { - self.format = Some(format.into()); + 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> { + 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/{}/products/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.policy_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -21059,8 +29270,14 @@ pub mod product_policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - if let Some(format) = &self.format { - url.query_pairs_mut().append_pair("format", format); + 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()); @@ -21070,7 +29287,7 @@ pub mod product_policy { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PolicyContract = + let rsp_value: models::ApiCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -21092,8 +29309,8 @@ pub mod product_policy { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::PolicyContract), - Ok200(models::PolicyContract), + Created201(models::ApiContract), + Ok200(models::ApiContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -21123,26 +29340,20 @@ pub mod product_policy { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) policy_id: String, - pub(crate) parameters: models::PolicyContract, + pub(crate) api_id: String, 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/{}/products/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.policy_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -21154,11 +29365,7 @@ pub mod product_policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - if let Some(if_match) = &self.if_match { - req_builder = req_builder.header("If-Match", if_match); - } - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -21166,13 +29373,13 @@ pub mod product_policy { 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::PolicyContract = + let rsp_value: models::ApiContract = 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::PolicyContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -21225,21 +29432,20 @@ pub mod product_policy { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) policy_id: String, - pub(crate) if_match: String, + pub(crate) api_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/{}/products/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.policy_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -21251,7 +29457,6 @@ pub mod product_policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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)?; @@ -21274,7 +29479,7 @@ pub mod product_policy { } } } - pub mod get_entity_tag { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -21300,213 +29505,93 @@ pub mod product_policy { } #[derive(Clone)] pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) policy_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/{}/products/{}/policies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.policy_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", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = 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 tag { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - subscription_id: impl Into, - ) -> list_by_product::Builder { - list_by_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - pub fn get_by_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - tag_id: impl Into, - subscription_id: impl Into, - ) -> get_by_product::Builder { - get_by_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn assign_to_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - tag_id: impl Into, - subscription_id: impl Into, - ) -> assign_to_product::Builder { - assign_to_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn detach_from_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - tag_id: impl Into, - subscription_id: impl Into, - ) -> detach_from_product::Builder { - detach_from_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) api_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/{}/products/{}/apis/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.api_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", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::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 get_entity_state_by_product( + } +} +pub mod product_group { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_product( &self, resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - tag_id: impl Into, subscription_id: impl Into, - ) -> get_entity_state_by_product::Builder { - get_entity_state_by_product::Builder { + ) -> list_by_product::Builder { + list_by_product::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), - } - } - 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, - scope: None, - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - tag_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(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - tag_id: impl Into, - parameters: impl Into, + product_id: impl Into, + group_id: 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(), - tag_id: tag_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - tag_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - tag_id: tag_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), + product_id: product_id.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -21514,31 +29599,33 @@ pub mod tag { &self, resource_group_name: impl Into, service_name: impl Into, - tag_id: impl Into, - if_match: impl Into, + product_id: impl Into, + group_id: 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(), - tag_id: tag_id.into(), - if_match: if_match.into(), + product_id: product_id.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } - pub fn get_entity_state( + pub fn check_entity_exists( &self, resource_group_name: impl Into, service_name: impl Into, - tag_id: impl Into, + product_id: impl Into, + group_id: impl Into, subscription_id: impl Into, - ) -> get_entity_state::Builder { - get_entity_state::Builder { + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - tag_id: tag_id.into(), + product_id: product_id.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -21591,10 +29678,10 @@ pub mod tag { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/products/{}/tags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -21628,88 +29715,7 @@ pub mod tag { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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_product { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: String, - pub(crate) tag_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/{}/products/{}/tags/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.tag_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", "2021-08-01"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagContract = + let rsp_value: models::GroupCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -21727,12 +29733,12 @@ pub mod tag { } } } - pub mod assign_to_product { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::TagContract), - Ok200(models::TagContract), + Created201(models::GroupContract), + Ok200(models::GroupContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -21762,20 +29768,20 @@ pub mod tag { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) tag_id: String, + pub(crate) group_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/{}/products/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.tag_id + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -21795,13 +29801,13 @@ pub mod tag { 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::TagContract = + let rsp_value: models::GroupContract = 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::TagContract = + let rsp_value: models::GroupContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -21819,7 +29825,7 @@ pub mod tag { } } } - pub mod detach_from_product { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { @@ -21854,20 +29860,20 @@ pub mod tag { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) tag_id: String, + pub(crate) group_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/{}/products/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.tag_id + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -21901,7 +29907,7 @@ pub mod tag { } } } - pub mod get_entity_state_by_product { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -21931,20 +29937,20 @@ pub mod tag { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) tag_id: String, + pub(crate) group_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/{}/products/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.tag_id + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -21962,7 +29968,7 @@ pub mod tag { let rsp = 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(()), + 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::ErrorResponse = @@ -21977,7 +29983,31 @@ pub mod tag { } } } - pub mod list_by_service { +} +pub mod product_subscriptions { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -22006,11 +30036,11 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) product_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, - pub(crate) scope: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -22025,18 +30055,15 @@ pub mod tag { self.skip = Some(skip); self } - pub fn scope(mut self, scope: impl Into) -> Self { - self.scope = Some(scope.into()); - self - } - 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.ApiManagement/service/{}/tags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/subscriptions", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -22057,9 +30084,6 @@ pub mod tag { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } - if let Some(scope) = &self.scope { - url.query_pairs_mut().append_pair("scope", scope); - } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -22068,7 +30092,7 @@ pub mod tag { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagCollection = + let rsp_value: models::SubscriptionCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -22086,7 +30110,102 @@ pub mod tag { } } } - pub mod get { +} +pub mod product_policy { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list_by_product::Builder { + list_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + format: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_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, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_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, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_product { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -22115,19 +30234,19 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, + pub(crate) product_id: String, 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.ApiManagement/service/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -22147,7 +30266,7 @@ pub mod tag { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagContract = + let rsp_value: models::PolicyCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -22165,13 +30284,8 @@ pub mod tag { } } } - pub mod create_or_update { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::TagContract), - Ok200(models::TagContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -22199,29 +30313,30 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, - pub(crate) parameters: models::TagCreateUpdateParameters, + pub(crate) product_id: String, + pub(crate) policy_id: String, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) format: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.into()); self } - 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.ApiManagement/service/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -22229,27 +30344,20 @@ pub mod tag { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); - 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); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::TagContract = - 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::TagContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -22265,8 +30373,13 @@ pub mod tag { } } } - pub mod update { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -22294,25 +30407,31 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, - pub(crate) parameters: models::TagCreateUpdateParameters, - pub(crate) if_match: String, + pub(crate) product_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -22320,19 +30439,27 @@ pub mod tag { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } 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.header("If-Match", &self.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::PolicyContract = + 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::TagContract = + let rsp_value: models::PolicyContract = 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)?; @@ -22382,7 +30509,8 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, + pub(crate) product_id: String, + pub(crate) policy_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -22390,12 +30518,13 @@ pub mod tag { 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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -22430,7 +30559,7 @@ pub mod tag { } } } - pub mod get_entity_state { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -22459,19 +30588,21 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, + pub(crate) product_id: String, + pub(crate) policy_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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); diff --git a/services/mgmt/apimanagement/src/package_preview_2019_12/operations.rs b/services/mgmt/apimanagement/src/package_preview_2019_12/operations.rs index 8b1662e1fe..6f5c56a8d8 100644 --- a/services/mgmt/apimanagement/src/package_preview_2019_12/operations.rs +++ b/services/mgmt/apimanagement/src/package_preview_2019_12/operations.rs @@ -77,9 +77,21 @@ impl Client { pub fn api(&self) -> api::Client { api::Client(self.clone()) } + pub fn api_diagnostic(&self) -> api_diagnostic::Client { + api_diagnostic::Client(self.clone()) + } pub fn api_export(&self) -> api_export::Client { api_export::Client(self.clone()) } + pub fn api_issue(&self) -> api_issue::Client { + api_issue::Client(self.clone()) + } + pub fn api_issue_attachment(&self) -> api_issue_attachment::Client { + api_issue_attachment::Client(self.clone()) + } + pub fn api_issue_comment(&self) -> api_issue_comment::Client { + api_issue_comment::Client(self.clone()) + } pub fn api_management_operations(&self) -> api_management_operations::Client { api_management_operations::Client(self.clone()) } @@ -89,6 +101,30 @@ impl Client { pub fn api_management_service_skus(&self) -> api_management_service_skus::Client { api_management_service_skus::Client(self.clone()) } + pub fn api_operation(&self) -> api_operation::Client { + api_operation::Client(self.clone()) + } + pub fn api_operation_policy(&self) -> api_operation_policy::Client { + api_operation_policy::Client(self.clone()) + } + pub fn api_policy(&self) -> api_policy::Client { + api_policy::Client(self.clone()) + } + pub fn api_product(&self) -> api_product::Client { + api_product::Client(self.clone()) + } + pub fn api_release(&self) -> api_release::Client { + api_release::Client(self.clone()) + } + pub fn api_revision(&self) -> api_revision::Client { + api_revision::Client(self.clone()) + } + pub fn api_schema(&self) -> api_schema::Client { + api_schema::Client(self.clone()) + } + pub fn api_tag_description(&self) -> api_tag_description::Client { + api_tag_description::Client(self.clone()) + } pub fn api_version_set(&self) -> api_version_set::Client { api_version_set::Client(self.clone()) } @@ -155,6 +191,9 @@ impl Client { pub fn open_id_connect_provider(&self) -> open_id_connect_provider::Client { open_id_connect_provider::Client(self.clone()) } + pub fn operation(&self) -> operation::Client { + operation::Client(self.clone()) + } pub fn policy(&self) -> policy::Client { policy::Client(self.clone()) } @@ -235,6 +274,152 @@ pub enum Error { #[error(transparent)] ApiExport_Get(#[from] api_export::get::Error), #[error(transparent)] + Api_ListByService(#[from] api::list_by_service::Error), + #[error(transparent)] + Api_Get(#[from] api::get::Error), + #[error(transparent)] + Api_CreateOrUpdate(#[from] api::create_or_update::Error), + #[error(transparent)] + Api_Update(#[from] api::update::Error), + #[error(transparent)] + Api_Delete(#[from] api::delete::Error), + #[error(transparent)] + Api_GetEntityTag(#[from] api::get_entity_tag::Error), + #[error(transparent)] + ApiRevision_ListByService(#[from] api_revision::list_by_service::Error), + #[error(transparent)] + ApiRelease_ListByService(#[from] api_release::list_by_service::Error), + #[error(transparent)] + ApiRelease_Get(#[from] api_release::get::Error), + #[error(transparent)] + ApiRelease_CreateOrUpdate(#[from] api_release::create_or_update::Error), + #[error(transparent)] + ApiRelease_Update(#[from] api_release::update::Error), + #[error(transparent)] + ApiRelease_Delete(#[from] api_release::delete::Error), + #[error(transparent)] + ApiRelease_GetEntityTag(#[from] api_release::get_entity_tag::Error), + #[error(transparent)] + ApiOperation_ListByApi(#[from] api_operation::list_by_api::Error), + #[error(transparent)] + ApiOperation_Get(#[from] api_operation::get::Error), + #[error(transparent)] + ApiOperation_CreateOrUpdate(#[from] api_operation::create_or_update::Error), + #[error(transparent)] + ApiOperation_Update(#[from] api_operation::update::Error), + #[error(transparent)] + ApiOperation_Delete(#[from] api_operation::delete::Error), + #[error(transparent)] + ApiOperation_GetEntityTag(#[from] api_operation::get_entity_tag::Error), + #[error(transparent)] + ApiOperationPolicy_ListByOperation(#[from] api_operation_policy::list_by_operation::Error), + #[error(transparent)] + ApiOperationPolicy_Get(#[from] api_operation_policy::get::Error), + #[error(transparent)] + ApiOperationPolicy_CreateOrUpdate(#[from] api_operation_policy::create_or_update::Error), + #[error(transparent)] + ApiOperationPolicy_Delete(#[from] api_operation_policy::delete::Error), + #[error(transparent)] + ApiOperationPolicy_GetEntityTag(#[from] api_operation_policy::get_entity_tag::Error), + #[error(transparent)] + Tag_ListByOperation(#[from] tag::list_by_operation::Error), + #[error(transparent)] + Tag_GetByOperation(#[from] tag::get_by_operation::Error), + #[error(transparent)] + Tag_AssignToOperation(#[from] tag::assign_to_operation::Error), + #[error(transparent)] + Tag_DetachFromOperation(#[from] tag::detach_from_operation::Error), + #[error(transparent)] + Tag_GetEntityStateByOperation(#[from] tag::get_entity_state_by_operation::Error), + #[error(transparent)] + ApiProduct_ListByApis(#[from] api_product::list_by_apis::Error), + #[error(transparent)] + ApiPolicy_ListByApi(#[from] api_policy::list_by_api::Error), + #[error(transparent)] + ApiPolicy_Get(#[from] api_policy::get::Error), + #[error(transparent)] + ApiPolicy_CreateOrUpdate(#[from] api_policy::create_or_update::Error), + #[error(transparent)] + ApiPolicy_Delete(#[from] api_policy::delete::Error), + #[error(transparent)] + ApiPolicy_GetEntityTag(#[from] api_policy::get_entity_tag::Error), + #[error(transparent)] + ApiSchema_ListByApi(#[from] api_schema::list_by_api::Error), + #[error(transparent)] + ApiSchema_Get(#[from] api_schema::get::Error), + #[error(transparent)] + ApiSchema_CreateOrUpdate(#[from] api_schema::create_or_update::Error), + #[error(transparent)] + ApiSchema_Delete(#[from] api_schema::delete::Error), + #[error(transparent)] + ApiSchema_GetEntityTag(#[from] api_schema::get_entity_tag::Error), + #[error(transparent)] + ApiDiagnostic_ListByService(#[from] api_diagnostic::list_by_service::Error), + #[error(transparent)] + ApiDiagnostic_Get(#[from] api_diagnostic::get::Error), + #[error(transparent)] + ApiDiagnostic_CreateOrUpdate(#[from] api_diagnostic::create_or_update::Error), + #[error(transparent)] + ApiDiagnostic_Update(#[from] api_diagnostic::update::Error), + #[error(transparent)] + ApiDiagnostic_Delete(#[from] api_diagnostic::delete::Error), + #[error(transparent)] + ApiDiagnostic_GetEntityTag(#[from] api_diagnostic::get_entity_tag::Error), + #[error(transparent)] + ApiIssue_ListByService(#[from] api_issue::list_by_service::Error), + #[error(transparent)] + ApiIssue_Get(#[from] api_issue::get::Error), + #[error(transparent)] + ApiIssue_CreateOrUpdate(#[from] api_issue::create_or_update::Error), + #[error(transparent)] + ApiIssue_Update(#[from] api_issue::update::Error), + #[error(transparent)] + ApiIssue_Delete(#[from] api_issue::delete::Error), + #[error(transparent)] + ApiIssue_GetEntityTag(#[from] api_issue::get_entity_tag::Error), + #[error(transparent)] + ApiIssueComment_ListByService(#[from] api_issue_comment::list_by_service::Error), + #[error(transparent)] + ApiIssueComment_Get(#[from] api_issue_comment::get::Error), + #[error(transparent)] + ApiIssueComment_CreateOrUpdate(#[from] api_issue_comment::create_or_update::Error), + #[error(transparent)] + ApiIssueComment_Delete(#[from] api_issue_comment::delete::Error), + #[error(transparent)] + ApiIssueComment_GetEntityTag(#[from] api_issue_comment::get_entity_tag::Error), + #[error(transparent)] + ApiIssueAttachment_ListByService(#[from] api_issue_attachment::list_by_service::Error), + #[error(transparent)] + ApiIssueAttachment_Get(#[from] api_issue_attachment::get::Error), + #[error(transparent)] + ApiIssueAttachment_CreateOrUpdate(#[from] api_issue_attachment::create_or_update::Error), + #[error(transparent)] + ApiIssueAttachment_Delete(#[from] api_issue_attachment::delete::Error), + #[error(transparent)] + ApiIssueAttachment_GetEntityTag(#[from] api_issue_attachment::get_entity_tag::Error), + #[error(transparent)] + ApiTagDescription_ListByService(#[from] api_tag_description::list_by_service::Error), + #[error(transparent)] + ApiTagDescription_Get(#[from] api_tag_description::get::Error), + #[error(transparent)] + ApiTagDescription_CreateOrUpdate(#[from] api_tag_description::create_or_update::Error), + #[error(transparent)] + ApiTagDescription_Delete(#[from] api_tag_description::delete::Error), + #[error(transparent)] + ApiTagDescription_GetEntityTag(#[from] api_tag_description::get_entity_tag::Error), + #[error(transparent)] + Tag_ListByApi(#[from] tag::list_by_api::Error), + #[error(transparent)] + Tag_GetByApi(#[from] tag::get_by_api::Error), + #[error(transparent)] + Tag_AssignToApi(#[from] tag::assign_to_api::Error), + #[error(transparent)] + Tag_DetachFromApi(#[from] tag::detach_from_api::Error), + #[error(transparent)] + Tag_GetEntityStateByApi(#[from] tag::get_entity_state_by_api::Error), + #[error(transparent)] + Operation_ListByTags(#[from] operation::list_by_tags::Error), + #[error(transparent)] Api_ListByTags(#[from] api::list_by_tags::Error), #[error(transparent)] ApiVersionSet_ListByService(#[from] api_version_set::list_by_service::Error), @@ -803,6 +988,109 @@ pub mod api { use super::models; 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, + tags: None, + expand_api_version_set: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + delete_revisions: None, + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } pub fn list_by_tags( &self, resource_group_name: impl Into, @@ -821,7 +1109,7 @@ pub mod api { } } } - pub mod list_by_tags { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -854,7 +1142,8 @@ pub mod api { pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, - pub(crate) include_not_tagged_apis: Option, + pub(crate) tags: Option, + pub(crate) expand_api_version_set: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -869,14 +1158,18 @@ pub mod api { self.skip = Some(skip); self } - pub fn include_not_tagged_apis(mut self, include_not_tagged_apis: bool) -> Self { - self.include_not_tagged_apis = Some(include_not_tagged_apis); + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.into()); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn expand_api_version_set(mut self, expand_api_version_set: bool) -> Self { + self.expand_api_version_set = Some(expand_api_version_set); + 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/{}/apisByTags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -901,9 +1194,12 @@ pub mod api { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } - if let Some(include_not_tagged_apis) = &self.include_not_tagged_apis { + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } + if let Some(expand_api_version_set) = &self.expand_api_version_set { url.query_pairs_mut() - .append_pair("includeNotTaggedApis", &include_not_tagged_apis.to_string()); + .append_pair("expandApiVersionSet", &expand_api_version_set.to_string()); } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); @@ -913,7 +1209,7 @@ pub mod api { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagResourceCollection = + let rsp_value: models::ApiCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -931,255 +1227,48 @@ pub mod api { } } } -} -pub mod api_version_set { - use super::models; - 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, - version_set_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(), - version_set_id: version_set_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - version_set_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(), - version_set_id: version_set_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - version_set_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - version_set_id: version_set_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - version_set_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(), - version_set_id: version_set_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, - version_set_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(), - version_set_id: version_set_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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/{}/apiVersionSets", - 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", "2019-12-01-preview"); - 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::ApiVersionSetCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_id: String, + pub(crate) api_id: String, 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.ApiManagement/service/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1199,7 +1288,7 @@ pub mod api_version_set { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiVersionSetContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1221,8 +1310,9 @@ pub mod api_version_set { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::ApiVersionSetContract), - Ok200(models::ApiVersionSetContract), + Created201(models::ApiContract), + Accepted202, + Ok200(models::ApiContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1251,8 +1341,8 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, - pub(crate) parameters: models::ApiVersionSetContract, + pub(crate) api_id: String, + pub(crate) parameters: models::ApiCreateOrUpdateParameter, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -1264,12 +1354,12 @@ pub mod api_version_set { 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/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1293,13 +1383,14 @@ pub mod api_version_set { 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::ApiVersionSetContract = + let rsp_value: models::ApiContract = 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), http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiVersionSetContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -1346,8 +1437,8 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, - pub(crate) parameters: models::ApiVersionSetUpdateParameters, + pub(crate) api_id: String, + pub(crate) parameters: models::ApiUpdateContract, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -1355,12 +1446,12 @@ pub mod api_version_set { 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/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1429,20 +1520,25 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, + pub(crate) api_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) delete_revisions: Option, } impl Builder { + pub fn delete_revisions(mut self, delete_revisions: bool) -> Self { + self.delete_revisions = Some(delete_revisions); + 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/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1454,6 +1550,9 @@ pub mod api_version_set { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); + if let Some(delete_revisions) = &self.delete_revisions { + url.query_pairs_mut().append_pair("deleteRevisions", &delete_revisions.to_string()); + } 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()); @@ -1506,19 +1605,19 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, + pub(crate) api_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/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1551,128 +1650,7 @@ pub mod api_version_set { } } } -} -pub mod authorization_server { - use super::models; - 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, - authsid: 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(), - authsid: authsid.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: 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(), - authsid: authsid.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - authsid: authsid.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: 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(), - authsid: authsid.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, - authsid: 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(), - authsid: authsid.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_secrets( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: impl Into, - subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - authsid: authsid.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod list_by_tags { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1705,6 +1683,7 @@ pub mod authorization_server { pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, + pub(crate) include_not_tagged_apis: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -1719,12 +1698,14 @@ pub mod authorization_server { self.skip = Some(skip); self } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn include_not_tagged_apis(mut self, include_not_tagged_apis: bool) -> Self { + self.include_not_tagged_apis = Some(include_not_tagged_apis); + 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/{}/authorizationServers", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apisByTags", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -1749,6 +1730,10 @@ pub mod authorization_server { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } + if let Some(include_not_tagged_apis) = &self.include_not_tagged_apis { + url.query_pairs_mut() + .append_pair("includeNotTaggedApis", &include_not_tagged_apis.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)?; @@ -1757,7 +1742,7 @@ pub mod authorization_server { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerCollection = + let rsp_value: models::TagResourceCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1775,7 +1760,31 @@ pub mod authorization_server { } } } - pub mod get { +} +pub mod api_revision { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1804,21 +1813,34 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, + pub(crate) api_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/revisions", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1830,6 +1852,15 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); + 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)?; @@ -1838,7 +1869,7 @@ pub mod authorization_server { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerContract = + let rsp_value: models::ApiRevisionCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1856,63 +1887,185 @@ pub mod authorization_server { } } } - pub mod create_or_update { - use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::AuthorizationServerContract), - Ok200(models::AuthorizationServerContract), +} +pub mod api_release { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } } - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_id.into(), + subscription_id: subscription_id.into(), + } } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) authsid: String, - pub(crate) parameters: models::AuthorizationServerContract, + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + release_id: release_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_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, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + 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> { + 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -1920,27 +2073,26 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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); + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerContract = - 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::AuthorizationServerContract = + let rsp_value: models::ApiReleaseCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -1956,7 +2108,7 @@ pub mod authorization_server { } } } - pub mod update { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1985,25 +2137,25 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, - pub(crate) parameters: models::AuthorizationServerUpdateContract, - pub(crate) if_match: String, + pub(crate) api_id: String, + pub(crate) release_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2011,15 +2163,18 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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.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::NO_CONTENT => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiReleaseContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -2034,12 +2189,12 @@ pub mod authorization_server { } } } - pub mod delete { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200, - NoContent204, + Created201(models::ApiReleaseContract), + Ok200(models::ApiReleaseContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2068,24 +2223,31 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, - pub(crate) if_match: String, + pub(crate) api_id: String, + pub(crate) release_id: String, + pub(crate) parameters: models::ApiReleaseContract, 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2093,15 +2255,28 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - req_builder = req_builder.header("If-Match", &self.if_match); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiReleaseContract = + 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::ApiReleaseContract = + 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 = @@ -2116,7 +2291,7 @@ pub mod authorization_server { } } } - pub mod get_entity_tag { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2145,23 +2320,27 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, + pub(crate) api_id: String, + pub(crate) release_id: String, + pub(crate) parameters: models::ApiReleaseContract, + pub(crate) if_match: 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2169,13 +2348,15 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => Ok(()), + 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::ErrorResponse = @@ -2190,8 +2371,13 @@ pub mod authorization_server { } } } - pub mod list_secrets { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -2219,16 +2405,26 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, + pub(crate) api_id: String, + pub(crate) release_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> { + 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/{}/authorizationServers/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . authsid) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2236,19 +2432,15 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); 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::ClientSecretContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -2263,39 +2455,120 @@ pub mod authorization_server { } } } -} -pub mod backend { - use super::models; - 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 { + pub mod get_entity_tag { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) release_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/{}/apis/{}/releases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.release_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_operation { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, + tags: None, } } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, + api_id: impl Into, + operation_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(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), } } @@ -2303,15 +2576,17 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_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(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -2321,8 +2596,9 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -2330,7 +2606,8 @@ pub mod backend { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), @@ -2340,7 +2617,8 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, + api_id: impl Into, + operation_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -2348,7 +2626,8 @@ pub mod backend { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -2357,35 +2636,21 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, + api_id: impl Into, + operation_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(), - backend_id: backend_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn reconnect( - &self, - resource_group_name: impl Into, - service_name: impl Into, - backend_id: impl Into, - subscription_id: impl Into, - ) -> reconnect::Builder { - reconnect::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), - parameters: None, } } } - pub mod list_by_service { + pub mod list_by_api { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2414,10 +2679,12 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) api_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, + pub(crate) tags: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -2432,14 +2699,19 @@ pub mod backend { self.skip = Some(skip); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.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/{}/backends", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2460,6 +2732,9 @@ pub mod backend { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -2468,7 +2743,7 @@ pub mod backend { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackendCollection = + let rsp_value: models::OperationCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2515,19 +2790,21 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, 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.ApiManagement/service/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2547,7 +2824,7 @@ pub mod backend { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackendContract = + let rsp_value: models::OperationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2569,8 +2846,8 @@ pub mod backend { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::BackendContract), - Ok200(models::BackendContract), + Created201(models::OperationContract), + Ok200(models::OperationContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2599,8 +2876,9 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, - pub(crate) parameters: models::BackendContract, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) parameters: models::OperationContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -2612,12 +2890,13 @@ pub mod backend { 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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2641,13 +2920,13 @@ pub mod backend { 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::BackendContract = + let rsp_value: models::OperationContract = 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::BackendContract = + let rsp_value: models::OperationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -2694,8 +2973,9 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, - pub(crate) parameters: models::BackendUpdateParameters, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) parameters: models::OperationUpdateContract, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -2703,12 +2983,13 @@ pub mod backend { 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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2777,7 +3058,8 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -2785,12 +3067,13 @@ pub mod backend { 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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2854,19 +3137,21 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, + pub(crate) api_id: String, + pub(crate) operation_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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2899,167 +3184,77 @@ pub mod backend { } } } - pub mod reconnect { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) backend_id: 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<(), Error>> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}/reconnect", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.backend_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", "2019-12-01-preview"); - 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::ACCEPTED => 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 cache { +pub mod api_operation_policy { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_service( + pub fn list_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> list_by_operation::Builder { + list_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), - top: None, - skip: None, } } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_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(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), + format: None, } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_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(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, } } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - cache_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - cache_id: cache_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -3067,7 +3262,9 @@ pub mod cache { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -3076,19 +3273,23 @@ pub mod cache { &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_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(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_service { + pub mod list_by_operation { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3117,27 +3318,21 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, pub(crate) subscription_id: String, - pub(crate) top: Option, - pub(crate) skip: Option, } impl Builder { - 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> { + 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/{}/caches", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -3149,12 +3344,6 @@ pub mod cache { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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)?; @@ -3163,7 +3352,7 @@ pub mod cache { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CacheCollection = + let rsp_value: models::PolicyCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -3210,20 +3399,20 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_id: String, pub(crate) subscription_id: String, + pub(crate) format: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3234,6 +3423,9 @@ pub mod cache { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -3242,7 +3434,7 @@ pub mod cache { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CacheContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -3264,8 +3456,8 @@ pub mod cache { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::CacheContract), - Ok200(models::CacheContract), + Created201(models::PolicyContract), + Ok200(models::PolicyContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3294,8 +3486,10 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, - pub(crate) parameters: models::CacheContract, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -3306,14 +3500,7 @@ pub mod cache { } 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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3336,13 +3523,13 @@ pub mod cache { 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::CacheContract = + let rsp_value: models::PolicyContract = 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::CacheContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -3360,84 +3547,6 @@ pub mod cache { } } } - pub mod update { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) cache_id: String, - pub(crate) parameters: models::CacheUpdateParameters, - pub(crate) if_match: 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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_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", "2019-12-01-preview"); - 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.header("If-Match", &self.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::NO_CONTENT => 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 delete { use super::models; #[derive(Debug)] @@ -3472,21 +3581,16 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3549,20 +3653,15 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3595,64 +3694,7903 @@ pub mod cache { } } } -pub mod certificate { +pub mod tag { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_service( + pub fn list_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> list_by_operation::Builder { + list_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, } } - pub fn get( + pub fn get_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> get::Builder { - get::Builder { + ) -> get_by_operation::Builder { + get_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), } } - pub fn create_or_update( + pub fn assign_to_operation( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> create_or_update::Builder { - create_or_update::Builder { + ) -> assign_to_operation::Builder { + assign_to_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), - parameters: parameters.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), - if_match: None, } } - pub fn delete( + pub fn detach_from_operation( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> detach_from_operation::Builder { + detach_from_operation::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state_by_operation( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state_by_operation::Builder { + get_entity_state_by_operation::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_by_api::Builder { + get_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn assign_to_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> assign_to_api::Builder { + assign_to_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn detach_from_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> detach_from_api::Builder { + detach_from_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state_by_api::Builder { + get_entity_state_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list_by_product::Builder { + list_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_by_product::Builder { + get_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn assign_to_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> assign_to_product::Builder { + assign_to_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn detach_from_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> detach_from_product::Builder { + detach_from_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state_by_product::Builder { + get_entity_state_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + 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, + scope: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_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(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_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(), + tag_id: tag_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + tag_id: tag_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_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(), + tag_id: tag_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state::Builder { + get_entity_state::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: 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/{}/apis/{}/operations/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2019-12-01-preview"); + 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::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 assign_to_operation { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TagContract = + 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::TagContract = + 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 detach_from_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_state_by_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2019-12-01-preview"); + 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::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 assign_to_api { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TagContract = + 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::TagContract = + 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 detach_from_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_state_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_by_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: 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/{}/products/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_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", "2019-12-01-preview"); + 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::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 assign_to_product { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TagContract = + 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::TagContract = + 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 detach_from_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_state_by_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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, + pub(crate) scope: 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 scope(mut self, scope: impl Into) -> Self { + self.scope = Some(scope.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/{}/tags", + 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", "2019-12-01-preview"); + 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()); + } + if let Some(scope) = &self.scope { + url.query_pairs_mut().append_pair("scope", scope); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_id: String, + pub(crate) parameters: models::TagCreateUpdateParameters, + 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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2019-12-01-preview"); + 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::TagContract = + 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::TagContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_id: String, + pub(crate) parameters: models::TagCreateUpdateParameters, + pub(crate) if_match: 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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2019-12-01-preview"); + 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.header("If-Match", &self.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::NO_CONTENT => 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2019-12-01-preview"); + 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_state { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_product { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_apis( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_apis::Builder { + list_by_apis::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list_by_apis { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/products", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2019-12-01-preview"); + 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::ProductCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 api_policy { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + format: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_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, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_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, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_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/{}/apis/{}/policies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match 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)?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_id: String, + pub(crate) subscription_id: String, + pub(crate) format: Option, + } + impl Builder { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2019-12-01-preview"); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, + 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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2019-12-01-preview"); + 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::PolicyContract = + 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::PolicyContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2019-12-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_schema { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.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, + api_id: 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(), + api_id: api_id.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, + api_id: 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(), + api_id: api_id.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, + api_id: 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(), + api_id: api_id.into(), + schema_id: schema_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + force: None, + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + schema_id: schema_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/schemas", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2019-12-01-preview"); + 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::SchemaCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SchemaContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Accepted202, + Created201(models::SchemaContract), + Ok200(models::SchemaContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) schema_id: String, + pub(crate) parameters: models::SchemaContract, + 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2019-12-01-preview"); + 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::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SchemaContract = + 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::SchemaContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) schema_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + pub(crate) force: Option, + } + impl Builder { + pub fn force(mut self, force: bool) -> Self { + self.force = Some(force); + 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2019-12-01-preview"); + if let Some(force) = &self.force { + url.query_pairs_mut().append_pair("force", &force.to_string()); + } + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_diagnostic { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.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, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_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, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/diagnostics", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2019-12-01-preview"); + 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::DiagnosticCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::DiagnosticContract), + Ok200(models::DiagnosticContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + 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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2019-12-01-preview"); + 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::DiagnosticContract = + 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::DiagnosticContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + pub(crate) if_match: 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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2019-12-01-preview"); + 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.header("If-Match", &self.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::NO_CONTENT => 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2019-12-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_issue { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + expand_comments_attachments: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + expand_comments_attachments: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + issue_id: issue_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_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, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) expand_comments_attachments: 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 expand_comments_attachments(mut self, expand_comments_attachments: bool) -> Self { + self.expand_comments_attachments = Some(expand_comments_attachments); + 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/{}/apis/{}/issues", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2019-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(expand_comments_attachments) = &self.expand_comments_attachments { + url.query_pairs_mut() + .append_pair("expandCommentsAttachments", &expand_comments_attachments.to_string()); + } + 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::IssueCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) subscription_id: String, + pub(crate) expand_comments_attachments: Option, + } + impl Builder { + pub fn expand_comments_attachments(mut self, expand_comments_attachments: bool) -> Self { + self.expand_comments_attachments = Some(expand_comments_attachments); + 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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2019-12-01-preview"); + if let Some(expand_comments_attachments) = &self.expand_comments_attachments { + url.query_pairs_mut() + .append_pair("expandCommentsAttachments", &expand_comments_attachments.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::IssueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueContract), + Ok200(models::IssueContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) parameters: models::IssueContract, + 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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2019-12-01-preview"); + 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::IssueContract = + 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::IssueContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) parameters: models::IssueUpdateContract, + pub(crate) if_match: 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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2019-12-01-preview"); + 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.header("If-Match", &self.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::NO_CONTENT => 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2019-12-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_issue_comment { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: 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(), + api_id: api_id.into(), + issue_id: issue_id.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, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_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, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_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, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: 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/{}/apis/{}/issues/{}/comments", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2019-12-01-preview"); + 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::IssueCommentCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueCommentContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueCommentContract), + Ok200(models::IssueCommentContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_id: String, + pub(crate) parameters: models::IssueCommentContract, + 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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2019-12-01-preview"); + 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::IssueCommentContract = + 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::IssueCommentContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2019-12-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_issue_attachment { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: 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(), + api_id: api_id.into(), + issue_id: issue_id.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, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_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, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_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, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: 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/{}/apis/{}/issues/{}/attachments", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2019-12-01-preview"); + 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::IssueAttachmentCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueAttachmentContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueAttachmentContract), + Ok200(models::IssueAttachmentContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_id: String, + pub(crate) parameters: models::IssueAttachmentContract, + 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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2019-12-01-preview"); + 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::IssueAttachmentContract = + 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::IssueAttachmentContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2019-12-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_tag_description { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.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, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_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, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_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, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/tagDescriptions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2019-12-01-preview"); + 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::TagDescriptionCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagDescriptionContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::TagDescriptionContract), + Ok200(models::TagDescriptionContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_id: String, + pub(crate) parameters: models::TagDescriptionCreateParameters, + 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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2019-12-01-preview"); + 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::TagDescriptionContract = + 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::TagDescriptionContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2019-12-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 operation { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_tags( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_tags::Builder { + list_by_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + include_not_tagged_operations: None, + } + } + } + pub mod list_by_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) include_not_tagged_operations: 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 include_not_tagged_operations(mut self, include_not_tagged_operations: bool) -> Self { + self.include_not_tagged_operations = Some(include_not_tagged_operations); + 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/{}/apis/{}/operationsByTags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2019-12-01-preview"); + 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()); + } + if let Some(include_not_tagged_operations) = &self.include_not_tagged_operations { + url.query_pairs_mut() + .append_pair("includeNotTaggedOperations", &include_not_tagged_operations.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::TagResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod api_version_set { + use super::models; + 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, + version_set_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(), + version_set_id: version_set_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_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(), + version_set_id: version_set_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + version_set_id: version_set_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_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(), + version_set_id: version_set_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, + version_set_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(), + version_set_id: version_set_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/apiVersionSets", + 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", "2019-12-01-preview"); + 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::ApiVersionSetCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiVersionSetContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::ApiVersionSetContract), + Ok200(models::ApiVersionSetContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_id: String, + pub(crate) parameters: models::ApiVersionSetContract, + 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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2019-12-01-preview"); + 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::ApiVersionSetContract = + 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::ApiVersionSetContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_id: String, + pub(crate) parameters: models::ApiVersionSetUpdateParameters, + pub(crate) if_match: 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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2019-12-01-preview"); + 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.header("If-Match", &self.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::NO_CONTENT => 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2019-12-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 authorization_server { + use super::models; + 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, + authsid: 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(), + authsid: authsid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: 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(), + authsid: authsid.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + authsid: authsid.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: 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(), + authsid: authsid.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, + authsid: 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(), + authsid: authsid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + authsid: authsid.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/authorizationServers", + 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", "2019-12-01-preview"); + 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::AuthorizationServerCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationServerContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::AuthorizationServerContract), + Ok200(models::AuthorizationServerContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: String, + pub(crate) parameters: models::AuthorizationServerContract, + 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2019-12-01-preview"); + 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::AuthorizationServerContract = + 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::AuthorizationServerContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: String, + pub(crate) parameters: models::AuthorizationServerUpdateContract, + pub(crate) if_match: 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2019-12-01-preview"); + 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.header("If-Match", &self.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::NO_CONTENT => 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2019-12-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_secrets { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . authsid) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); + 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::ClientSecretContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 backend { + use super::models; + 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, + backend_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(), + backend_id: backend_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_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(), + backend_id: backend_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + backend_id: backend_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -3660,7 +11598,7 @@ pub mod certificate { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), + backend_id: backend_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -3669,20 +11607,221 @@ pub mod certificate { &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, + backend_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(), - certificate_id: certificate_id.into(), + backend_id: backend_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn reconnect( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_id: impl Into, + subscription_id: impl Into, + ) -> reconnect::Builder { + reconnect::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + backend_id: backend_id.into(), subscription_id: subscription_id.into(), + parameters: None, + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/backends", + 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", "2019-12-01-preview"); + 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::BackendCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) backend_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/{}/backends/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.backend_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackendContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_service { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::BackendContract), + Ok200(models::BackendContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -3710,36 +11849,29 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) backend_id: String, + pub(crate) parameters: models::BackendContract, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, + pub(crate) if_match: 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); + 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> { + 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/{}/certificates", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.backend_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -3747,27 +11879,188 @@ pub mod certificate { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); + 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); } - if let Some(top) = &self.top { - url.query_pairs_mut().append_pair("$top", &top.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::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackendContract = + 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::BackendContract = + 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, + }) + } } - if let Some(skip) = &self.skip { - url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + }) + } + } + } + pub mod update { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) backend_id: String, + pub(crate) parameters: models::BackendUpdateParameters, + pub(crate) if_match: 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/{}/backends/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.backend_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", "2019-12-01-preview"); + 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.header("If-Match", &self.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::NO_CONTENT => 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) backend_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/{}/backends/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.backend_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", "2019-12-01-preview"); + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CertificateCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -3782,7 +12075,7 @@ pub mod certificate { } } } - pub mod get { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3811,23 +12104,23 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, + pub(crate) backend_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.certificate_id + &self.backend_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -3841,12 +12134,7 @@ pub mod certificate { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CertificateContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -3861,13 +12149,8 @@ pub mod certificate { } } } - pub mod create_or_update { + pub mod reconnect { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::CertificateContract), - Ok200(models::CertificateContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -3895,29 +12178,28 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, - pub(crate) parameters: models::CertificateCreateOrUpdateParameters, + pub(crate) backend_id: String, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) parameters: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + 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> { + 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/{}/certificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}/reconnect", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.certificate_id + &self.backend_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -3925,28 +12207,18 @@ pub mod certificate { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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); - } + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CertificateContract = - 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::CertificateContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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::ErrorResponse = @@ -3961,13 +12233,113 @@ pub mod certificate { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, +} +pub mod cache { + use super::models; + 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(), + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_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(), + cache_id: cache_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_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(), + cache_id: cache_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + cache_id: cache_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_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(), + cache_id: cache_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, + cache_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(), + cache_id: cache_id.into(), + subscription_id: subscription_id.into(), + } } + } + pub mod list_by_service { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -3995,24 +12367,31 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, - pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/certificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.certificate_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4020,15 +12399,24 @@ pub mod certificate { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - req_builder = req_builder.header("If-Match", &self.if_match); + 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 => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CacheCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -4043,7 +12431,7 @@ pub mod certificate { } } } - pub mod get_entity_tag { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4072,23 +12460,23 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, + pub(crate) cache_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/certificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.certificate_id + &self.cache_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4102,7 +12490,12 @@ pub mod certificate { let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CacheContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -4117,21 +12510,20 @@ pub mod certificate { } } } -} -pub mod api_management_operations { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list(&self) -> list::Builder { - list::Builder { client: self.0.clone() } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::CacheContract), + Ok200(models::CacheContract), } - } - pub mod list { - use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Unexpected HTTP status code {}", status_code)] - UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -4150,14 +12542,31 @@ pub mod api_management_operations { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) cache_id: String, + pub(crate) parameters: models::CacheContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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!("{}/providers/Microsoft.ApiManagement/operations", self.client.endpoint(),); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.cache_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4165,23 +12574,35 @@ pub mod api_management_operations { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::CacheContract = + 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::OperationListResult = + let rsp_value: models::CacheContract = 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)?; - Err(Error::UnexpectedResponse { + 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, - body: rsp_body, + value: rsp_value, }) } } @@ -4189,27 +12610,7 @@ pub mod api_management_operations { } } } -} -pub mod api_management_service_skus { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Gets available SKUs for API Management service"] - pub fn list_available_service_skus( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> list_available_service_skus::Builder { - list_available_service_skus::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_available_service_skus { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4238,21 +12639,25 @@ pub mod api_management_service_skus { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) cache_id: String, + pub(crate) parameters: models::CacheUpdateParameters, + pub(crate) if_match: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/skus", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.cache_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4260,185 +12665,35 @@ pub mod api_management_service_skus { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ResourceSkuResults = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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::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 api_management_service { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn restore( - &self, - resource_group_name: impl Into, - service_name: impl Into, - parameters: impl Into, - subscription_id: impl Into, - ) -> restore::Builder { - restore::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn backup( - &self, - resource_group_name: impl Into, - service_name: impl Into, - parameters: impl Into, - subscription_id: impl Into, - ) -> backup::Builder { - backup::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: 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(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - 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(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_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(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: 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(), - 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 fn get_sso_token( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> get_sso_token::Builder { - get_sso_token::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - subscription_id: subscription_id.into(), - } - } - 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 apply_network_configuration_updates( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> apply_network_configuration_updates::Builder { - apply_network_configuration_updates::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - subscription_id: subscription_id.into(), - parameters: None, + serde_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 { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, + Ok200, + NoContent204, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4467,22 +12722,24 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, + pub(crate) cache_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/{}/restore", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.cache_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4490,20 +12747,15 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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.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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = - 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::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 = @@ -4518,13 +12770,8 @@ pub mod api_management_service { } } } - pub mod backup { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -4552,22 +12799,23 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, + pub(crate) cache_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.cache_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4575,20 +12823,13 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = - 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::OK => Ok(()), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -4603,7 +12844,94 @@ pub mod api_management_service { } } } - pub mod get { +} +pub mod certificate { + use super::models; + 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, + certificate_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(), + certificate_id: certificate_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + certificate_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(), + certificate_id: certificate_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, + certificate_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(), + certificate_id: certificate_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, + certificate_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(), + certificate_id: certificate_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4633,14 +12961,27 @@ pub mod api_management_service { 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 into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -4656,6 +12997,15 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); + 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)?; @@ -4664,7 +13014,7 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = + let rsp_value: models::CertificateCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -4682,14 +13032,8 @@ pub mod api_management_service { } } } - pub mod create_or_update { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ApiManagementServiceResource), - Created201(models::ApiManagementServiceResource), - Accepted202, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -4717,22 +13061,23 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceResource, + pub(crate) certificate_id: String, 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.ApiManagement/service/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.certificate_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4740,8 +13085,7 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -4749,17 +13093,10 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = - 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::ApiManagementServiceResource = + let rsp_value: models::CertificateContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Created201(rsp_value)) + Ok(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 = @@ -4774,12 +13111,12 @@ pub mod api_management_service { } } } - pub mod update { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, + Created201(models::CertificateContract), + Ok200(models::CertificateContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4808,22 +13145,29 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceUpdateParameters, + pub(crate) certificate_id: String, + pub(crate) parameters: models::CertificateCreateOrUpdateParameters, 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/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.certificate_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4833,18 +13177,26 @@ pub mod api_management_service { url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); 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::CertificateContract = + 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::ApiManagementServiceResource = + let rsp_value: models::CertificateContract = 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 = @@ -4864,7 +13216,6 @@ pub mod api_management_service { #[derive(Debug)] pub enum Response { Ok200, - Accepted202(models::ApiManagementServiceResource), NoContent204, } #[derive(Debug, thiserror :: Error)] @@ -4894,17 +13245,20 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) certificate_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/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.certificate_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -4916,6 +13270,7 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); + 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)?; @@ -4923,12 +13278,6 @@ pub mod api_management_service { 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::ApiManagementServiceResource = - 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)?; @@ -4944,7 +13293,7 @@ pub mod api_management_service { } } } - pub mod list_by_resource_group { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4972,22 +13321,24 @@ pub mod api_management_service { pub struct Builder { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) certificate_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", self.client.endpoint(), &self.subscription_id, - &self.resource_group_name + &self.resource_group_name, + &self.service_name, + &self.certificate_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5001,12 +13352,7 @@ pub mod api_management_service { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceListResult = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -5021,6 +13367,15 @@ pub mod api_management_service { } } } +} +pub mod api_management_operations { + use super::models; + 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; #[derive(Debug, thiserror :: Error)] @@ -5045,18 +13400,11 @@ pub mod api_management_service { #[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> { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.ApiManagement/service", - self.client.endpoint(), - &self.subscription_id - ); + let url_str = &format!("{}/providers/Microsoft.ApiManagement/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); @@ -5075,7 +13423,7 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceListResult = + let rsp_value: models::OperationListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -5091,7 +13439,27 @@ pub mod api_management_service { } } } - pub mod get_sso_token { +} +pub mod api_management_service_skus { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets available SKUs for API Management service"] + pub fn list_available_service_skus( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_available_service_skus::Builder { + list_available_service_skus::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_available_service_skus { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5123,13 +13491,10 @@ pub mod api_management_service { 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.ApiManagement/service/{}/getssotoken", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/skus", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -5137,7 +13502,7 @@ pub mod api_management_service { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5146,7 +13511,6 @@ pub mod api_management_service { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); 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)?; @@ -5154,7 +13518,7 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceGetSsoTokenResult = + let rsp_value: models::ResourceSkuResults = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -5172,8 +13536,160 @@ pub mod api_management_service { } } } - pub mod check_name_availability { +} +pub mod api_management_service { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn restore( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> restore::Builder { + restore::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn backup( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> backup::Builder { + backup::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: 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(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + 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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: 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(), + 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 fn get_sso_token( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> get_sso_token::Builder { + get_sso_token::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + 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 apply_network_configuration_updates( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> apply_network_configuration_updates::Builder { + apply_network_configuration_updates::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + } + pub mod restore { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -5199,19 +13715,20 @@ pub mod api_management_service { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) parameters: models::ApiManagementServiceCheckNameAvailabilityParameters, - pub(crate) subscription_id: String, - } - impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> - { + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, + pub(crate) subscription_id: 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.ApiManagement/checkNameAvailability", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/restore", self.client.endpoint(), - &self.subscription_id + &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(); @@ -5232,10 +13749,11 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceNameAvailabilityResult = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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 = @@ -5250,12 +13768,12 @@ pub mod api_management_service { } } } - pub mod apply_network_configuration_updates { + pub mod backup { use super::models; #[derive(Debug)] pub enum Response { - Accepted202, Ok200(models::ApiManagementServiceResource), + Accepted202, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5284,17 +13802,19 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, 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.ApiManagement/service/{}/applynetworkconfigurationupdates" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backup", + 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); @@ -5305,24 +13825,20 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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.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::ApiManagementServiceResource = 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 = @@ -5337,113 +13853,7 @@ pub mod api_management_service { } } } -} -pub mod diagnostic { - use super::models; - 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, - diagnostic_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(), - diagnostic_id: diagnostic_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - diagnostic_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(), - diagnostic_id: diagnostic_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - diagnostic_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - diagnostic_id: diagnostic_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - diagnostic_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(), - diagnostic_id: diagnostic_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, - diagnostic_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(), - diagnostic_id: diagnostic_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5473,27 +13883,14 @@ pub mod diagnostic { 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> { + 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/{}/diagnostics", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -5509,15 +13906,6 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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)?; @@ -5526,7 +13914,7 @@ pub mod diagnostic { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DiagnosticCollection = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -5544,8 +13932,14 @@ pub mod diagnostic { } } } - pub mod get { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Created201(models::ApiManagementServiceResource), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -5573,23 +13967,22 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, + pub(crate) parameters: models::ApiManagementServiceResource, 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.ApiManagement/service/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5597,7 +13990,8 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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)?; @@ -5605,10 +13999,17 @@ pub mod diagnostic { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DiagnosticContract = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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::ApiManagementServiceResource = + 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 = @@ -5623,12 +14024,12 @@ pub mod diagnostic { } } } - pub mod create_or_update { + pub mod update { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::DiagnosticContract), - Ok200(models::DiagnosticContract), + Ok200(models::ApiManagementServiceResource), + Accepted202, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5657,29 +14058,22 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, - pub(crate) parameters: models::DiagnosticContract, + pub(crate) parameters: models::ApiManagementServiceUpdateParameters, 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/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5689,26 +14083,18 @@ pub mod diagnostic { url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); 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::DiagnosticContract = - 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::DiagnosticContract = + let rsp_value: models::ApiManagementServiceResource = 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 = @@ -5723,8 +14109,14 @@ pub mod diagnostic { } } } - pub mod update { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::ApiManagementServiceResource), + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -5752,25 +14144,21 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, - pub(crate) parameters: models::DiagnosticContract, - pub(crate) if_match: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5778,15 +14166,20 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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.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::NO_CONTENT => Ok(()), + 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::ApiManagementServiceResource = + 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 = @@ -5801,13 +14194,8 @@ pub mod diagnostic { } } } - pub mod delete { + pub mod list_by_resource_group { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -5834,25 +14222,22 @@ pub mod diagnostic { pub struct Builder { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) diagnostic_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> { + 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/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service", self.client.endpoint(), &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.diagnostic_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::DELETE); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5860,15 +14245,18 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -5883,15 +14271,12 @@ pub mod diagnostic { } } } - pub mod get_entity_tag { + pub mod list { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -5910,25 +14295,21 @@ pub mod diagnostic { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) diagnostic_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/diagnostics/{}", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/service", self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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::HEAD); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5942,14 +14323,17 @@ pub mod diagnostic { let rsp = 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 => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ErrorResponse = + let rsp_value: models::ApiManagementServiceListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { status_code, - value: rsp_value, + body: rsp_body, }) } } @@ -5957,113 +14341,7 @@ pub mod diagnostic { } } } -} -pub mod email_template { - use super::models; - 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, - template_name: 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(), - template_name: template_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - template_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(), - service_name: service_name.into(), - template_name: template_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - template_name: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - template_name: template_name.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - template_name: 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(), - template_name: template_name.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, - template_name: 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(), - template_name: template_name.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod get_sso_token { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6093,27 +14371,15 @@ pub mod email_template { 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> { + 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/{}/templates", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/getssotoken", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -6121,7 +14387,7 @@ pub mod email_template { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6129,16 +14395,8 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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.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)?; @@ -6146,7 +14404,7 @@ pub mod email_template { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateCollection = + let rsp_value: models::ApiManagementServiceGetSsoTokenResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -6164,7 +14422,7 @@ pub mod email_template { } } } - pub mod get { + pub mod check_name_availability { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6191,25 +14449,23 @@ pub mod email_template { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) template_name: String, + pub(crate) parameters: models::ApiManagementServiceCheckNameAvailabilityParameters, 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.ApiManagement/service/{}/templates/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.template_name + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/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::GET); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6217,7 +14473,8 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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)?; @@ -6225,7 +14482,7 @@ pub mod email_template { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateContract = + let rsp_value: models::ApiManagementServiceNameAvailabilityResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -6243,12 +14500,12 @@ pub mod email_template { } } } - pub mod create_or_update { + pub mod apply_network_configuration_updates { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::EmailTemplateContract), - Ok200(models::EmailTemplateContract), + Accepted202, + Ok200(models::ApiManagementServiceResource), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6277,29 +14534,20 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, - pub(crate) parameters: models::EmailTemplateUpdateParameters, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) parameters: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + 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.ApiManagement/service/{}/templates/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.template_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/applynetworkconfigurationupdates" , 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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6307,25 +14555,21 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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); - } + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateContract = - 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), http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateContract = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -6343,7 +14587,113 @@ pub mod email_template { } } } - pub mod update { +} +pub mod diagnostic { + use super::models; + 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, + diagnostic_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(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + diagnostic_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(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + diagnostic_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + diagnostic_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(), + diagnostic_id: diagnostic_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, + diagnostic_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(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6372,25 +14722,36 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, - pub(crate) parameters: models::EmailTemplateUpdateParameters, - pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/templates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.template_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6398,15 +14759,27 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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.header("If-Match", &self.if_match); + 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::NO_CONTENT => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -6421,13 +14794,8 @@ pub mod email_template { } } } - pub mod delete { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6455,24 +14823,23 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, - pub(crate) if_match: String, + pub(crate) diagnostic_id: String, 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.ApiManagement/service/{}/templates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.template_name + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6480,15 +14847,18 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -6503,8 +14873,13 @@ pub mod email_template { } } } - pub mod get_entity_tag { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::DiagnosticContract), + Ok200(models::DiagnosticContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6532,23 +14907,29 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/templates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.template_name + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6556,13 +14937,28 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(()), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + 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::DiagnosticContract = + 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 = @@ -6577,161 +14973,7 @@ pub mod email_template { } } } -} -pub mod gateway { - use super::models; - 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(), - top: None, - skip: None, - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_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(), - gateway_id: gateway_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_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(), - gateway_id: gateway_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - gateway_id: gateway_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_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(), - gateway_id: gateway_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, - gateway_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(), - gateway_id: gateway_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_keys( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - subscription_id: impl Into, - ) -> list_keys::Builder { - list_keys::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - gateway_id: gateway_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn regenerate_key( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - subscription_id: impl Into, - parameters: impl Into, - ) -> regenerate_key::Builder { - regenerate_key::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - gateway_id: gateway_id.into(), - subscription_id: subscription_id.into(), - parameters: parameters.into(), - } - } - pub fn generate_token( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - parameters: impl Into, - subscription_id: impl Into, - ) -> generate_token::Builder { - generate_token::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - gateway_id: gateway_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6760,31 +15002,25 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + pub(crate) if_match: String, pub(crate) subscription_id: String, - pub(crate) top: Option, - pub(crate) skip: Option, } impl Builder { - 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> { + 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/{}/gateways", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6792,24 +15028,15 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.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::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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::ErrorResponse = @@ -6824,8 +15051,13 @@ pub mod gateway { } } } - pub mod get { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6853,23 +15085,24 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, + pub(crate) diagnostic_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> { + 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/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6877,18 +15110,15 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -6903,13 +15133,8 @@ pub mod gateway { } } } - pub mod create_or_update { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::GatewayContract), - Ok200(models::GatewayContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6937,29 +15162,23 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) parameters: models::GatewayContract, + pub(crate) diagnostic_id: String, 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> { + 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/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6967,28 +15186,13 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::GatewayContract = - 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::GatewayContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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 = @@ -7003,7 +15207,113 @@ pub mod gateway { } } } - pub mod update { +} +pub mod email_template { + use super::models; + 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, + template_name: 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(), + template_name: template_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + template_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(), + service_name: service_name.into(), + template_name: template_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + template_name: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + template_name: template_name.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + template_name: 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(), + template_name: template_name.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, + template_name: 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(), + template_name: template_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7032,25 +15342,36 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) parameters: models::GatewayContract, - pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.gateway_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7058,15 +15379,27 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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.header("If-Match", &self.if_match); + 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::NO_CONTENT => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EmailTemplateCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -7081,13 +15414,8 @@ pub mod gateway { } } } - pub mod delete { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7115,24 +15443,23 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) if_match: String, + pub(crate) template_name: String, 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.ApiManagement/service/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7140,15 +15467,18 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EmailTemplateContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -7163,8 +15493,13 @@ pub mod gateway { } } } - pub mod get_entity_tag { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::EmailTemplateContract), + Ok200(models::EmailTemplateContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7192,23 +15527,29 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, + pub(crate) template_name: String, + pub(crate) parameters: models::EmailTemplateUpdateParameters, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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::HEAD); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7216,13 +15557,28 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(()), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EmailTemplateContract = + 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::EmailTemplateContract = + 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 = @@ -7237,7 +15593,7 @@ pub mod gateway { } } } - pub mod list_keys { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7266,23 +15622,25 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, + pub(crate) template_name: String, + pub(crate) parameters: models::EmailTemplateUpdateParameters, + pub(crate) if_match: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/listKeys", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7290,19 +15648,15 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + 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.header("If-Match", &self.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::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayKeysContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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::ErrorResponse = @@ -7317,8 +15671,13 @@ pub mod gateway { } } } - pub mod regenerate_key { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7346,24 +15705,24 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, + pub(crate) template_name: String, + pub(crate) if_match: String, pub(crate) subscription_id: String, - pub(crate) parameters: models::GatewayKeyRegenerationRequestContract, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/gateways/{}/regenerateKey", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7371,14 +15730,15 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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.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::NO_CONTENT => Ok(()), + 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 = @@ -7393,7 +15753,7 @@ pub mod gateway { } } } - pub mod generate_token { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7422,24 +15782,23 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) parameters: models::GatewayTokenRequestContract, + pub(crate) template_name: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/generateToken", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7447,19 +15806,13 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayTokenContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -7475,7 +15828,7 @@ pub mod gateway { } } } -pub mod gateway_hostname_configuration { +pub mod gateway { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -7483,14 +15836,12 @@ pub mod gateway_hostname_configuration { &self, resource_group_name: impl Into, service_name: impl Into, - gateway_id: 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(), - gateway_id: gateway_id.into(), subscription_id: subscription_id.into(), top: None, skip: None, @@ -7501,7 +15852,6 @@ pub mod gateway_hostname_configuration { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - hc_id: impl Into, subscription_id: impl Into, ) -> get::Builder { get::Builder { @@ -7509,7 +15859,6 @@ pub mod gateway_hostname_configuration { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - hc_id: hc_id.into(), subscription_id: subscription_id.into(), } } @@ -7518,18 +15867,36 @@ pub mod gateway_hostname_configuration { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - hc_id: impl Into, + parameters: impl Into, subscription_id: impl Into, - parameters: 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(), gateway_id: gateway_id.into(), - hc_id: hc_id.into(), + parameters: parameters.into(), subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), } } pub fn delete( @@ -7537,7 +15904,7 @@ pub mod gateway_hostname_configuration { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - hc_id: impl Into, + if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { delete::Builder { @@ -7545,7 +15912,7 @@ pub mod gateway_hostname_configuration { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - hc_id: hc_id.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } @@ -7554,7 +15921,6 @@ pub mod gateway_hostname_configuration { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - hc_id: impl Into, subscription_id: impl Into, ) -> get_entity_tag::Builder { get_entity_tag::Builder { @@ -7562,7 +15928,55 @@ pub mod gateway_hostname_configuration { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - hc_id: hc_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_keys( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + subscription_id: impl Into, + ) -> list_keys::Builder { + list_keys::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn regenerate_key( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> regenerate_key::Builder { + regenerate_key::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + pub fn generate_token( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> generate_token::Builder { + generate_token::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + parameters: parameters.into(), subscription_id: subscription_id.into(), } } @@ -7596,7 +16010,6 @@ pub mod gateway_hostname_configuration { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, pub(crate) subscription_id: String, pub(crate) top: Option, pub(crate) skip: Option, @@ -7610,12 +16023,15 @@ pub mod gateway_hostname_configuration { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/gateways/{}/hostnameConfigurations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/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); @@ -7640,7 +16056,7 @@ pub mod gateway_hostname_configuration { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayHostnameConfigurationCollection = + let rsp_value: models::GatewayCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -7688,15 +16104,19 @@ pub mod gateway_hostname_configuration { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) hc_id: String, 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.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_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); @@ -7715,7 +16135,7 @@ pub mod gateway_hostname_configuration { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayHostnameConfigurationContract = + let rsp_value: models::GatewayContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -7737,8 +16157,8 @@ pub mod gateway_hostname_configuration { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::GatewayHostnameConfigurationContract), - Ok200(models::GatewayHostnameConfigurationContract), + Created201(models::GatewayContract), + Ok200(models::GatewayContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7768,14 +16188,25 @@ pub mod gateway_hostname_configuration { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) hc_id: String, + pub(crate) parameters: models::GatewayContract, pub(crate) subscription_id: String, - pub(crate) parameters: models::GatewayHostnameConfigurationContract, + 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/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_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); @@ -7788,6 +16219,9 @@ pub mod gateway_hostname_configuration { url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); 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)?; @@ -7795,13 +16229,13 @@ pub mod gateway_hostname_configuration { 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::GatewayHostnameConfigurationContract = + let rsp_value: models::GatewayContract = 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::GatewayHostnameConfigurationContract = + let rsp_value: models::GatewayContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -7819,13 +16253,8 @@ pub mod gateway_hostname_configuration { } } } - pub mod delete { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7854,16 +16283,24 @@ pub mod gateway_hostname_configuration { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) hc_id: String, + pub(crate) parameters: models::GatewayContract, + pub(crate) if_match: String, 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<(), Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7871,14 +16308,15 @@ pub mod gateway_hostname_configuration { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + 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::ErrorResponse = @@ -7892,9 +16330,14 @@ pub mod gateway_hostname_configuration { }) } } - } - pub mod get_entity_tag { - use super::models; + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7923,16 +16366,23 @@ pub mod gateway_hostname_configuration { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) hc_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<(), Error>> { + 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/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7940,13 +16390,15 @@ pub mod gateway_hostname_configuration { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); + 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(()), + 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 = @@ -7961,82 +16413,7 @@ pub mod gateway_hostname_configuration { } } } -} -pub mod gateway_api { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_service( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: 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(), - gateway_id: gateway_id.into(), - subscription_id: subscription_id.into(), - top: None, - skip: None, - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - api_id: 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(), - gateway_id: gateway_id.into(), - api_id: api_id.into(), - subscription_id: subscription_id.into(), - parameters: None, - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - api_id: 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(), - gateway_id: gateway_id.into(), - api_id: api_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn get_entity_tag( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - api_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(), - gateway_id: gateway_id.into(), - api_id: api_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8067,22 +16444,12 @@ pub mod gateway_api { pub(crate) service_name: String, pub(crate) gateway_id: String, pub(crate) subscription_id: String, - pub(crate) top: Option, - pub(crate) skip: Option, } impl Builder { - 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> { + 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/{}/gateways/{}/apis", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -8091,7 +16458,7 @@ pub mod gateway_api { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8099,24 +16466,13 @@ pub mod gateway_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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::ApiCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -8131,13 +16487,8 @@ pub mod gateway_api { } } } - pub mod create_or_update { + pub mod list_keys { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ApiContract), - Ok200(models::ApiContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8166,29 +16517,22 @@ pub mod gateway_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) api_id: 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> { + 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/{}/gateways/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/listKeys", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id, - &self.api_id + &self.gateway_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8196,28 +16540,18 @@ pub mod gateway_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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 - }; + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiContract = - 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::ApiContract = + let rsp_value: models::GatewayKeysContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -8233,13 +16567,8 @@ pub mod gateway_api { } } } - pub mod delete { + pub mod regenerate_key { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8268,24 +16597,23 @@ pub mod gateway_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) api_id: String, pub(crate) subscription_id: String, + pub(crate) parameters: models::GatewayKeyRegenerationRequestContract, } 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/regenerateKey", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id, - &self.api_id + &self.gateway_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8293,14 +16621,14 @@ pub mod gateway_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::NO_CONTENT => Ok(Response::NoContent204), + 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::ErrorResponse = @@ -8315,7 +16643,7 @@ pub mod gateway_api { } } } - pub mod get_entity_tag { + pub mod generate_token { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8345,24 +16673,23 @@ pub mod gateway_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) api_id: String, + pub(crate) parameters: models::GatewayTokenRequestContract, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/gateways/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/generateToken", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id, - &self.api_id + &self.gateway_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8370,13 +16697,19 @@ pub mod gateway_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayTokenContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -8392,7 +16725,7 @@ pub mod gateway_api { } } } -pub mod group { +pub mod gateway_hostname_configuration { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -8400,14 +16733,15 @@ pub mod group { &self, resource_group_name: impl Into, service_name: impl Into, + gateway_id: 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(), + gateway_id: gateway_id.into(), subscription_id: subscription_id.into(), - filter: None, top: None, skip: None, } @@ -8416,14 +16750,16 @@ pub mod group { &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, + gateway_id: impl Into, + hc_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(), - group_id: group_id.into(), + gateway_id: gateway_id.into(), + hc_id: hc_id.into(), subscription_id: subscription_id.into(), } } @@ -8431,53 +16767,35 @@ pub mod group { &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - parameters: impl Into, + gateway_id: impl Into, + hc_id: impl Into, subscription_id: impl Into, + parameters: 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(), - group_id: group_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - group_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - group_id: group_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + hc_id: hc_id.into(), subscription_id: subscription_id.into(), + parameters: parameters.into(), } } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - if_match: impl Into, + gateway_id: impl Into, + hc_id: 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(), - group_id: group_id.into(), - if_match: if_match.into(), + gateway_id: gateway_id.into(), + hc_id: hc_id.into(), subscription_id: subscription_id.into(), } } @@ -8485,14 +16803,16 @@ pub mod group { &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, + gateway_id: impl Into, + hc_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(), - group_id: group_id.into(), + gateway_id: gateway_id.into(), + hc_id: hc_id.into(), subscription_id: subscription_id.into(), } } @@ -8526,16 +16846,12 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) gateway_id: 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 @@ -8544,15 +16860,12 @@ pub mod group { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/groups", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_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); @@ -8563,9 +16876,6 @@ pub mod group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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()); } @@ -8580,7 +16890,7 @@ pub mod group { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GroupCollection = + let rsp_value: models::GatewayHostnameConfigurationCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -8627,20 +16937,16 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, + pub(crate) gateway_id: String, + pub(crate) hc_id: String, 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.ApiManagement/service/{}/groups/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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); @@ -8659,7 +16965,7 @@ pub mod group { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GroupContract = + let rsp_value: models::GatewayHostnameConfigurationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -8681,8 +16987,8 @@ pub mod group { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::GroupContract), - Ok200(models::GroupContract), + Created201(models::GatewayHostnameConfigurationContract), + Ok200(models::GatewayHostnameConfigurationContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8711,26 +17017,15 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) parameters: models::GroupCreateParameters, + pub(crate) gateway_id: String, + pub(crate) hc_id: String, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) parameters: models::GatewayHostnameConfigurationContract, } 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/{}/groups/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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); @@ -8743,9 +17038,6 @@ pub mod group { url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); 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)?; @@ -8753,13 +17045,13 @@ pub mod group { 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::GroupContract = + let rsp_value: models::GatewayHostnameConfigurationContract = 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::GroupContract = + let rsp_value: models::GatewayHostnameConfigurationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -8777,84 +17069,6 @@ pub mod group { } } } - pub mod update { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) group_id: String, - pub(crate) parameters: models::GroupUpdateParameters, - pub(crate) if_match: 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/{}/groups/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.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::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", "2019-12-01-preview"); - 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.header("If-Match", &self.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::NO_CONTENT => 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 delete { use super::models; #[derive(Debug)] @@ -8889,21 +17103,14 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) if_match: String, + pub(crate) gateway_id: String, + pub(crate) hc_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/{}/groups/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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); @@ -8914,7 +17121,6 @@ pub mod group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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)?; @@ -8966,20 +17172,14 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, + pub(crate) gateway_id: String, + pub(crate) hc_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/{}/groups/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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); @@ -9012,81 +17212,81 @@ pub mod group { } } } -pub mod group_user { +pub mod gateway_api { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, + gateway_id: impl Into, subscription_id: impl Into, - ) -> list::Builder { - list::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - group_id: group_id.into(), + gateway_id: gateway_id.into(), subscription_id: subscription_id.into(), - filter: None, top: None, skip: None, } } - pub fn create( + pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - user_id: impl Into, + gateway_id: impl Into, + api_id: impl Into, subscription_id: impl Into, - ) -> create::Builder { - create::Builder { + ) -> create_or_update::Builder { + create_or_update::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - group_id: group_id.into(), - user_id: user_id.into(), + gateway_id: gateway_id.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), + parameters: None, } } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - user_id: impl Into, + gateway_id: impl Into, + api_id: 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(), - group_id: group_id.into(), - user_id: user_id.into(), + gateway_id: gateway_id.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), } } - pub fn check_entity_exists( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - user_id: impl Into, + gateway_id: impl Into, + api_id: impl Into, subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - group_id: group_id.into(), - user_id: user_id.into(), + gateway_id: gateway_id.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), } } } - pub mod list { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9115,17 +17315,12 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, + pub(crate) gateway_id: 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 - } + } + impl Builder { pub fn top(mut self, top: i32) -> Self { self.top = Some(top); self @@ -9134,15 +17329,15 @@ pub mod group_user { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/groups/{}/users", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.gateway_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -9154,9 +17349,6 @@ pub mod group_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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()); } @@ -9171,7 +17363,7 @@ pub mod group_user { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::UserCollection = + let rsp_value: models::ApiCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -9189,12 +17381,12 @@ pub mod group_user { } } } - pub mod create { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::UserContract), - Ok200(models::UserContract), + Created201(models::ApiContract), + Ok200(models::ApiContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9223,21 +17415,26 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) user_id: String, + pub(crate) gateway_id: String, + pub(crate) api_id: 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.ApiManagement/service/{}/groups/{}/users/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id, - &self.user_id + &self.gateway_id, + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -9249,7 +17446,12 @@ pub mod group_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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)?; @@ -9257,13 +17459,13 @@ pub mod group_user { 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::UserContract = + let rsp_value: models::ApiContract = 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::UserContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -9315,21 +17517,21 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) user_id: String, + pub(crate) gateway_id: String, + pub(crate) api_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/{}/groups/{}/users/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id, - &self.user_id + &self.gateway_id, + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -9363,12 +17565,10 @@ pub mod group_user { } } } - pub mod check_entity_exists { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Error response #response_type")] - NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -9394,21 +17594,21 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) user_id: String, + pub(crate) gateway_id: String, + pub(crate) api_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/{}/groups/{}/users/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id, - &self.user_id + &self.gateway_id, + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -9426,8 +17626,7 @@ pub mod group_user { let 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(()), - http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + 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 = @@ -9443,7 +17642,7 @@ pub mod group_user { } } } -pub mod identity_provider { +pub mod group { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -9458,20 +17657,23 @@ pub mod identity_provider { 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, - identity_provider_name: impl Into, + group_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(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -9479,15 +17681,15 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, - parameters: impl Into, + group_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(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -9497,8 +17699,8 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, - parameters: impl Into, + group_id: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -9506,7 +17708,7 @@ pub mod identity_provider { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), @@ -9516,7 +17718,7 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, + group_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -9524,7 +17726,7 @@ pub mod identity_provider { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -9533,29 +17735,14 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, + group_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(), - identity_provider_name: identity_provider_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_secrets( - &self, - resource_group_name: impl Into, - service_name: impl Into, - identity_provider_name: impl Into, - subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -9590,12 +17777,27 @@ pub mod identity_provider { 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 into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/identityProviders", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -9611,6 +17813,15 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); + 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)?; @@ -9619,7 +17830,7 @@ pub mod identity_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IdentityProviderList = + let rsp_value: models::GroupCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -9666,19 +17877,19 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, + pub(crate) group_id: String, 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.ApiManagement/service/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -9698,7 +17909,7 @@ pub mod identity_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IdentityProviderContract = + let rsp_value: models::GroupContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -9720,8 +17931,8 @@ pub mod identity_provider { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::IdentityProviderContract), - Ok200(models::IdentityProviderContract), + Created201(models::GroupContract), + Ok200(models::GroupContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9750,8 +17961,8 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, - pub(crate) parameters: models::IdentityProviderCreateContract, + pub(crate) group_id: String, + pub(crate) parameters: models::GroupCreateParameters, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -9763,12 +17974,12 @@ pub mod identity_provider { 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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -9792,13 +18003,13 @@ pub mod identity_provider { 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::IdentityProviderContract = + let rsp_value: models::GroupContract = 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::IdentityProviderContract = + let rsp_value: models::GroupContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -9845,8 +18056,8 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, - pub(crate) parameters: models::IdentityProviderUpdateParameters, + pub(crate) group_id: String, + pub(crate) parameters: models::GroupUpdateParameters, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -9854,12 +18065,12 @@ pub mod identity_provider { 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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -9928,24 +18139,100 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, - pub(crate) if_match: String, + pub(crate) group_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/{}/groups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.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::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", "2019-12-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) group_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.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::DELETE); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9953,15 +18240,13 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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), + 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 = @@ -9976,7 +18261,82 @@ pub mod identity_provider { } } } - pub mod get_entity_tag { +} +pub mod group_user { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn create( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + user_id: 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(), + group_id: group_id.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -10005,23 +18365,38 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, + pub(crate) group_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.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::HEAD); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -10029,13 +18404,27 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); + 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 => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UserCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -10050,8 +18439,13 @@ pub mod identity_provider { } } } - pub mod list_secrets { + pub mod create { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::UserContract), + Ok200(models::UserContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -10079,16 +18473,25 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, + pub(crate) group_id: String, + pub(crate) user_id: String, 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.ApiManagement/service/{}/identityProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . identity_provider_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.group_id, + &self.user_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -10097,17 +18500,22 @@ pub mod identity_provider { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); 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::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UserContract = + 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::ClientSecretContract = + let rsp_value: models::UserContract = 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)?; @@ -10123,45 +18531,13 @@ pub mod identity_provider { } } } -} -pub mod issue { - use super::models; - 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, - issue_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(), - issue_id: issue_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -10189,36 +18565,25 @@ pub mod issue { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) group_id: String, + pub(crate) user_id: 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> { + 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/{}/issues", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.group_id, + &self.user_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -10226,27 +18591,14 @@ pub mod issue { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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::IssueCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -10261,10 +18613,12 @@ pub mod issue { } } } - pub mod get { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -10290,23 +18644,25 @@ pub mod issue { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) issue_id: String, + pub(crate) group_id: String, + pub(crate) user_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/issues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.issue_id + &self.group_id, + &self.user_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -10320,12 +18676,8 @@ pub mod issue { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IssueContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + http::StatusCode::NO_CONTENT => Ok(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -10341,7 +18693,7 @@ pub mod issue { } } } -pub mod logger { +pub mod identity_provider { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -10356,23 +18708,20 @@ pub mod logger { 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, - logger_id: impl Into, + identity_provider_name: 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(), - logger_id: logger_id.into(), + identity_provider_name: identity_provider_name.into(), subscription_id: subscription_id.into(), } } @@ -10380,15 +18729,15 @@ pub mod logger { &self, resource_group_name: impl Into, service_name: impl Into, - logger_id: impl Into, - parameters: impl Into, + identity_provider_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(), service_name: service_name.into(), - logger_id: logger_id.into(), + identity_provider_name: identity_provider_name.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -10398,8 +18747,8 @@ pub mod logger { &self, resource_group_name: impl Into, service_name: impl Into, - logger_id: impl Into, - parameters: impl Into, + identity_provider_name: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -10407,7 +18756,7 @@ pub mod logger { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - logger_id: logger_id.into(), + identity_provider_name: identity_provider_name.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), @@ -10417,7 +18766,7 @@ pub mod logger { &self, resource_group_name: impl Into, service_name: impl Into, - logger_id: impl Into, + identity_provider_name: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -10425,24 +18774,38 @@ pub mod logger { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - logger_id: logger_id.into(), + identity_provider_name: identity_provider_name.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), - force: None, } } pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, - logger_id: impl Into, + identity_provider_name: 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(), - logger_id: logger_id.into(), + identity_provider_name: identity_provider_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + identity_provider_name: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + identity_provider_name: identity_provider_name.into(), subscription_id: subscription_id.into(), } } @@ -10477,27 +18840,12 @@ pub mod logger { 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> { + 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/{}/loggers", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -10513,15 +18861,6 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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)?; @@ -10530,7 +18869,7 @@ pub mod logger { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::LoggerCollection = + let rsp_value: models::IdentityProviderList = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -10577,19 +18916,19 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, + pub(crate) identity_provider_name: String, 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.ApiManagement/service/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.identity_provider_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -10609,7 +18948,7 @@ pub mod logger { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::LoggerContract = + let rsp_value: models::IdentityProviderContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -10631,8 +18970,8 @@ pub mod logger { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::LoggerContract), - Ok200(models::LoggerContract), + Created201(models::IdentityProviderContract), + Ok200(models::IdentityProviderContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -10661,8 +19000,8 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, - pub(crate) parameters: models::LoggerContract, + pub(crate) identity_provider_name: String, + pub(crate) parameters: models::IdentityProviderCreateContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -10674,12 +19013,12 @@ pub mod logger { 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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.identity_provider_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -10703,13 +19042,13 @@ pub mod logger { 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::LoggerContract = + let rsp_value: models::IdentityProviderContract = 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::LoggerContract = + let rsp_value: models::IdentityProviderContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -10756,8 +19095,8 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, - pub(crate) parameters: models::LoggerUpdateContract, + pub(crate) identity_provider_name: String, + pub(crate) parameters: models::IdentityProviderUpdateParameters, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -10765,12 +19104,12 @@ pub mod logger { 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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.identity_provider_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -10839,25 +19178,20 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, + pub(crate) identity_provider_name: String, pub(crate) if_match: String, pub(crate) subscription_id: String, - pub(crate) force: Option, } impl Builder { - pub fn force(mut self, force: bool) -> Self { - self.force = Some(force); - 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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.identity_provider_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -10870,9 +19204,6 @@ pub mod logger { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); req_builder = req_builder.header("If-Match", &self.if_match); - if let Some(force) = &self.force { - url.query_pairs_mut().append_pair("force", &force.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)?; @@ -10924,131 +19255,23 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_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/{}/loggers/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.logger_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", "2019-12-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = 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 network_status { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_service( - &self, - subscription_id: impl Into, - resource_group_name: impl Into, - service_name: impl Into, - ) -> list_by_service::Builder { - list_by_service::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_by_location( - &self, - subscription_id: impl Into, - resource_group_name: impl Into, - service_name: impl Into, - location_name: impl Into, - ) -> list_by_location::Builder { - list_by_location::Builder { - client: self.0.clone(), - subscription_id: subscription_id.into(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - location_name: location_name.into(), - } - } - } - pub mod list_by_service { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), - } - #[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) identity_provider_name: String, + pub(crate) subscription_id: String, } impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + 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/{}/networkstatus", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.identity_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11062,12 +19285,7 @@ pub mod network_status { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); 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) - } + 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 = @@ -11082,7 +19300,7 @@ pub mod network_status { } } } - pub mod list_by_location { + pub mod list_secrets { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11109,25 +19327,18 @@ pub mod network_status { #[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) location_name: String, + pub(crate) identity_provider_name: String, + 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.ApiManagement/service/{}/locations/{}/networkstatus", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.location_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . identity_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11136,6 +19347,7 @@ pub mod network_status { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); 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)?; @@ -11143,7 +19355,7 @@ pub mod network_status { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NetworkStatusContract = + let rsp_value: models::ClientSecretContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -11162,7 +19374,7 @@ pub mod network_status { } } } -pub mod notification { +pub mod issue { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -11177,6 +19389,7 @@ pub mod notification { resource_group_name: resource_group_name.into(), service_name: service_name.into(), subscription_id: subscription_id.into(), + filter: None, top: None, skip: None, } @@ -11185,31 +19398,15 @@ pub mod notification { &self, resource_group_name: impl Into, service_name: impl Into, - notification_name: impl Into, + issue_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(), - notification_name: notification_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_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(), - service_name: service_name.into(), - notification_name: notification_name.into(), + issue_id: issue_id.into(), subscription_id: subscription_id.into(), - if_match: None, } } } @@ -11243,10 +19440,15 @@ pub mod notification { 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 @@ -11255,10 +19457,10 @@ pub mod notification { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/notifications", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/issues", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -11274,6 +19476,9 @@ pub mod notification { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); + 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()); } @@ -11288,7 +19493,7 @@ pub mod notification { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NotificationCollection = + let rsp_value: models::IssueCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -11335,19 +19540,19 @@ pub mod notification { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, + pub(crate) issue_id: String, 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.ApiManagement/service/{}/notifications/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/issues/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.notification_name + &self.issue_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -11367,94 +19572,7 @@ pub mod notification { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NotificationContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) notification_name: String, - 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/{}/notifications/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.notification_name - ); - let mut url = 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", "2019-12-01-preview"); - if let Some(if_match) = &self.if_match { - req_builder = req_builder.header("If-Match", 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NotificationContract = + let rsp_value: models::IssueContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -11473,22 +19591,38 @@ pub mod notification { } } } -pub mod notification_recipient_user { +pub mod logger { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_notification( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - notification_name: impl Into, subscription_id: impl Into, - ) -> list_by_notification::Builder { - list_by_notification::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - notification_name: notification_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, + logger_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(), + logger_id: logger_id.into(), subscription_id: subscription_id.into(), } } @@ -11496,16 +19630,36 @@ pub mod notification_recipient_user { &self, resource_group_name: impl Into, service_name: impl Into, - notification_name: impl Into, - user_id: impl Into, + logger_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(), - notification_name: notification_name.into(), - user_id: user_id.into(), + logger_id: logger_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + logger_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + logger_id: logger_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } @@ -11513,38 +19667,37 @@ pub mod notification_recipient_user { &self, resource_group_name: impl Into, service_name: impl Into, - notification_name: impl Into, - user_id: impl Into, + logger_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(), - notification_name: notification_name.into(), - user_id: user_id.into(), + logger_id: logger_id.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), + force: None, } } - pub fn check_entity_exists( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, - notification_name: impl Into, - user_id: impl Into, + logger_id: impl Into, subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - notification_name: notification_name.into(), - user_id: user_id.into(), + logger_id: logger_id.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_notification { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11573,13 +19726,33 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/notifications/{}/recipientUsers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers", + 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); @@ -11590,6 +19763,15 @@ pub mod notification_recipient_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); + 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)?; @@ -11598,7 +19780,7 @@ pub mod notification_recipient_user { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientUserCollection = + let rsp_value: models::LoggerCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -11616,13 +19798,8 @@ pub mod notification_recipient_user { } } } - pub mod create_or_update { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::RecipientUserContract), - Ok200(models::RecipientUserContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -11650,17 +19827,23 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) user_id: String, + pub(crate) logger_id: String, 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.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.logger_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11674,17 +19857,11 @@ pub mod notification_recipient_user { let 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::RecipientUserContract = - 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::RecipientUserContract = + let rsp_value: models::LoggerContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -11700,12 +19877,12 @@ pub mod notification_recipient_user { } } } - pub mod delete { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200, - NoContent204, + Created201(models::LoggerContract), + Ok200(models::LoggerContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11734,17 +19911,29 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) user_id: String, + pub(crate) logger_id: String, + pub(crate) parameters: models::LoggerContract, 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/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.logger_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11752,14 +19941,28 @@ pub mod notification_recipient_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoggerContract = + 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::LoggerContract = + 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 = @@ -11774,12 +19977,10 @@ pub mod notification_recipient_user { } } } - pub mod check_entity_exists { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Error response #response_type")] - NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -11805,17 +20006,25 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) user_id: String, + pub(crate) logger_id: String, + pub(crate) parameters: models::LoggerUpdateContract, + pub(crate) if_match: 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/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.logger_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11823,14 +20032,15 @@ pub mod notification_recipient_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::NO_CONTENT => Ok(()), - http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -11845,80 +20055,13 @@ pub mod notification_recipient_user { } } } -} -pub mod notification_recipient_email { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_notification( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - subscription_id: impl Into, - ) -> list_by_notification::Builder { - list_by_notification::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - notification_name: notification_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - email: 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(), - notification_name: notification_name.into(), - email: email.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - email: 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(), - notification_name: notification_name.into(), - email: email.into(), - subscription_id: subscription_id.into(), - } - } - pub fn check_entity_exists( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - email: impl Into, - subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - notification_name: notification_name.into(), - email: email.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_notification { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -11946,16 +20089,29 @@ pub mod notification_recipient_email { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, + pub(crate) logger_id: String, + pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) force: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn force(mut self, force: bool) -> Self { + self.force = Some(force); + 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/{}/notifications/{}/recipientEmails" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.logger_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11963,18 +20119,18 @@ pub mod notification_recipient_email { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + if let Some(force) = &self.force { + url.query_pairs_mut().append_pair("force", &force.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::RecipientEmailCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 = @@ -11989,13 +20145,8 @@ pub mod notification_recipient_email { } } } - pub mod create_or_update { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::RecipientEmailContract), - Ok200(models::RecipientEmailContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12023,17 +20174,23 @@ pub mod notification_recipient_email { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) email: String, + pub(crate) logger_id: String, 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<(), Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.logger_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12047,18 +20204,7 @@ pub mod notification_recipient_email { let 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::RecipientEmailContract = - 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::RecipientEmailContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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 = @@ -12073,13 +20219,42 @@ pub mod notification_recipient_email { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, +} +pub mod network_status { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> list_by_service::Builder { + list_by_service::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_by_location( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + location_name: impl Into, + ) -> list_by_location::Builder { + list_by_location::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + location_name: location_name.into(), + } } + } + pub mod list_by_service { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12105,19 +20280,25 @@ pub mod notification_recipient_email { #[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) notification_name: String, - pub(crate) email: String, - 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, Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/networkstatus", + 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12131,8 +20312,12 @@ pub mod notification_recipient_email { let rsp = 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::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::ErrorResponse = @@ -12147,12 +20332,10 @@ pub mod notification_recipient_email { } } } - pub mod check_entity_exists { + pub mod list_by_location { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Error response #response_type")] - NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -12176,19 +20359,25 @@ pub mod notification_recipient_email { #[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) notification_name: String, - pub(crate) email: String, - pub(crate) subscription_id: String, + pub(crate) location_name: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/locations/{}/networkstatus", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.location_name + ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12202,8 +20391,12 @@ pub mod notification_recipient_email { let 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(()), - http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkStatusContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -12219,7 +20412,7 @@ pub mod notification_recipient_email { } } } -pub mod open_id_connect_provider { +pub mod notification { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -12234,7 +20427,6 @@ pub mod open_id_connect_provider { resource_group_name: resource_group_name.into(), service_name: service_name.into(), subscription_id: subscription_id.into(), - filter: None, top: None, skip: None, } @@ -12243,14 +20435,14 @@ pub mod open_id_connect_provider { &self, resource_group_name: impl Into, service_name: impl Into, - opid: impl Into, + notification_name: 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(), - opid: opid.into(), + notification_name: notification_name.into(), subscription_id: subscription_id.into(), } } @@ -12258,86 +20450,18 @@ pub mod open_id_connect_provider { &self, resource_group_name: impl Into, service_name: impl Into, - opid: impl Into, - parameters: impl Into, + notification_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(), service_name: service_name.into(), - opid: opid.into(), - parameters: parameters.into(), + notification_name: notification_name.into(), subscription_id: subscription_id.into(), if_match: None, } } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - opid: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - opid: opid.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - opid: 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(), - opid: opid.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, - opid: 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(), - opid: opid.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_secrets( - &self, - resource_group_name: impl Into, - service_name: impl Into, - opid: impl Into, - subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - opid: opid.into(), - subscription_id: subscription_id.into(), - } - } } pub mod list_by_service { use super::models; @@ -12369,15 +20493,10 @@ pub mod open_id_connect_provider { 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 @@ -12386,12 +20505,10 @@ pub mod open_id_connect_provider { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/openidConnectProviders", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -12407,9 +20524,6 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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()); } @@ -12424,7 +20538,7 @@ pub mod open_id_connect_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OpenIdConnectProviderCollection = + let rsp_value: models::NotificationCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -12471,21 +20585,19 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, + pub(crate) notification_name: String, 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.ApiManagement/service/{}/openidConnectProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.opid + &self.notification_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -12505,7 +20617,7 @@ pub mod open_id_connect_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OpenidConnectProviderContract = + let rsp_value: models::NotificationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -12520,16 +20632,11 @@ pub mod open_id_connect_provider { } } }) - } - } - } - pub mod create_or_update { - use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::OpenidConnectProviderContract), - Ok200(models::OpenidConnectProviderContract), + } } + } + pub mod create_or_update { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12557,8 +20664,7 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, - pub(crate) parameters: models::OpenidConnectProviderContract, + pub(crate) notification_name: String, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -12567,15 +20673,15 @@ pub mod open_id_connect_provider { self.if_match = Some(if_match.into()); self } - 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.ApiManagement/service/{}/openidConnectProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.opid + &self.notification_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -12587,27 +20693,20 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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); } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::OpenidConnectProviderContract = - 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::OpenidConnectProviderContract = + let rsp_value: models::NotificationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -12623,7 +20722,79 @@ pub mod open_id_connect_provider { } } } - pub mod update { +} +pub mod notification_recipient_user { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_notification( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + subscription_id: impl Into, + ) -> list_by_notification::Builder { + list_by_notification::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + user_id: 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(), + notification_name: notification_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + user_id: 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(), + notification_name: notification_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_notification { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12652,25 +20823,16 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, - pub(crate) parameters: models::OpenidConnectProviderUpdateContract, - pub(crate) if_match: String, + pub(crate) notification_name: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12678,15 +20840,18 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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.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::NO_CONTENT => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecipientUserCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -12701,12 +20866,12 @@ pub mod open_id_connect_provider { } } } - pub mod delete { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200, - NoContent204, + Created201(models::RecipientUserContract), + Ok200(models::RecipientUserContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12735,24 +20900,17 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, - pub(crate) if_match: String, + pub(crate) notification_name: String, + pub(crate) user_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/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12760,15 +20918,24 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecipientUserContract = + 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::RecipientUserContract = + 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 = @@ -12783,8 +20950,13 @@ pub mod open_id_connect_provider { } } } - pub mod get_entity_tag { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12812,23 +20984,17 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, + pub(crate) notification_name: String, + pub(crate) user_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12842,7 +21008,8 @@ pub mod open_id_connect_provider { let rsp = 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(()), + 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 = @@ -12857,10 +21024,12 @@ pub mod open_id_connect_provider { } } } - pub mod list_secrets { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -12886,16 +21055,17 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, + pub(crate) notification_name: String, + pub(crate) user_id: String, 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<(), Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . opid) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12904,18 +21074,13 @@ pub mod open_id_connect_provider { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); 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::ClientSecretContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + http::StatusCode::NO_CONTENT => Ok(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -12931,91 +21096,78 @@ pub mod open_id_connect_provider { } } } -pub mod policy { +pub mod notification_recipient_email { use super::models; 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(), - } - } - pub fn get( + pub fn list_by_notification( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, + notification_name: impl Into, subscription_id: impl Into, - ) -> get::Builder { - get::Builder { + ) -> list_by_notification::Builder { + list_by_notification::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - policy_id: policy_id.into(), + notification_name: notification_name.into(), subscription_id: subscription_id.into(), - format: None, } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, - parameters: impl Into, + notification_name: impl Into, + email: 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(), - policy_id: policy_id.into(), - parameters: parameters.into(), + notification_name: notification_name.into(), + email: email.into(), subscription_id: subscription_id.into(), - if_match: None, } } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, - if_match: impl Into, + notification_name: impl Into, + email: 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(), - policy_id: policy_id.into(), - if_match: if_match.into(), + notification_name: notification_name.into(), + email: email.into(), subscription_id: subscription_id.into(), } } - pub fn get_entity_tag( + pub fn check_entity_exists( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, + notification_name: impl Into, + email: impl Into, subscription_id: impl Into, - ) -> get_entity_tag::Builder { - get_entity_tag::Builder { + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - policy_id: policy_id.into(), + notification_name: notification_name.into(), + email: email.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_service { + pub mod list_by_notification { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13044,18 +21196,13 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) notification_name: String, 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.ApiManagement/service/{}/policies", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::GET); @@ -13074,7 +21221,7 @@ pub mod policy { match 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 = + let rsp_value: models::RecipientEmailCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -13092,8 +21239,13 @@ pub mod policy { } } } - pub mod get { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::RecipientEmailContract), + Ok200(models::RecipientEmailContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13121,28 +21273,17 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, + pub(crate) notification_name: String, + pub(crate) email: String, pub(crate) subscription_id: String, - pub(crate) format: Option, } impl Builder { - pub fn format(mut self, format: impl Into) -> Self { - self.format = Some(format.into()); - self - } - 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.ApiManagement/service/{}/policies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.policy_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13150,20 +21291,23 @@ pub mod policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - if let Some(format) = &self.format { - url.query_pairs_mut().append_pair("format", format); - } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::RecipientEmailContract = + 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::PolicyContract = + let rsp_value: models::RecipientEmailContract = 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)?; @@ -13179,12 +21323,12 @@ pub mod policy { } } } - pub mod create_or_update { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::PolicyContract), - Ok200(models::PolicyContract), + Ok200, + NoContent204, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13213,29 +21357,17 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, - pub(crate) parameters: models::PolicyContract, + pub(crate) notification_name: String, + pub(crate) email: String, 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/{}/policies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.policy_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; let mut url = 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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13243,28 +21375,85 @@ pub mod policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::PolicyContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Created201(rsp_value)) - } - http::StatusCode::OK => { + 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::PolicyContract = + let rsp_value: models::ErrorResponse = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) } + } + }) + } + } + } + pub mod check_entity_exists { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) notification_name: String, + pub(crate) email: 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/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let mut url = 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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -13279,13 +21468,129 @@ pub mod policy { } } } - pub mod delete { +} +pub mod open_id_connect_provider { + use super::models; + 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, + opid: 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(), + opid: opid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: 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(), + opid: opid.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + opid: opid.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: 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(), + opid: opid.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, + opid: 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(), + opid: opid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + opid: opid.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13313,24 +21618,38 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, - pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.policy_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13338,15 +21657,27 @@ pub mod policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - req_builder = req_builder.header("If-Match", &self.if_match); + 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 => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenIdConnectProviderCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -13361,7 +21692,7 @@ pub mod policy { } } } - pub mod get_entity_tag { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13390,23 +21721,25 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, + pub(crate) opid: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.policy_id + &self.opid ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13420,7 +21753,12 @@ pub mod policy { let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenidConnectProviderContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -13435,28 +21773,13 @@ pub mod policy { } } } -} -pub mod policy_description { - use super::models; - 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(), - scope: None, - } - } - } - pub mod list_by_service { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::OpenidConnectProviderContract), + Ok200(models::OpenidConnectProviderContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13484,130 +21807,73 @@ pub mod policy_description { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) opid: String, + pub(crate) parameters: models::OpenidConnectProviderContract, pub(crate) subscription_id: String, - pub(crate) scope: Option, + pub(crate) if_match: Option, } impl Builder { - pub fn scope(mut self, scope: impl Into) -> Self { - self.scope = Some(scope.into()); + 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> { + 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/{}/policyDescriptions", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.opid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + 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", "2019-12-01-preview"); - if let Some(scope) = &self.scope { - url.query_pairs_mut().append_pair("scope", scope); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PolicyDescriptionCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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 sign_in_settings { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - resource_group_name: impl Into, - service_name: 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(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - 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(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - parameters: parameters.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, - 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(), - subscription_id: subscription_id.into(), + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); + 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::OpenidConnectProviderContract = + 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::OpenidConnectProviderContract = + 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 get { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13636,21 +21902,25 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) opid: String, + pub(crate) parameters: models::OpenidConnectProviderUpdateContract, + pub(crate) if_match: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.opid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13658,18 +21928,15 @@ pub mod sign_in_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSigninSettings = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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::ErrorResponse = @@ -13684,8 +21951,13 @@ pub mod sign_in_settings { } } } - pub mod create_or_update { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13713,27 +21985,24 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSigninSettings, + pub(crate) opid: String, + pub(crate) if_match: String, 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> { + 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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.opid ); let mut url = 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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13741,22 +22010,15 @@ pub mod sign_in_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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.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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSigninSettings = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -13771,7 +22033,7 @@ pub mod sign_in_settings { } } } - pub mod update { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13800,23 +22062,23 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSigninSettings, - pub(crate) if_match: String, + pub(crate) opid: 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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.opid ); let mut url = 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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13824,15 +22086,13 @@ pub mod sign_in_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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.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::NO_CONTENT => Ok(()), + 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 = @@ -13847,7 +22107,7 @@ pub mod sign_in_settings { } } } - pub mod get_entity_tag { + pub mod list_secrets { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13876,21 +22136,16 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) opid: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/portalsettings/signin", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . opid) ; let mut url = 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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13899,12 +22154,18 @@ pub mod sign_in_settings { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClientSecretContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -13920,52 +22181,70 @@ pub mod sign_in_settings { } } } -pub mod sign_up_settings { +pub mod policy { use super::models; 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(), + } + } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, + policy_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(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), + format: None, } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + policy_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(), + policy_id: policy_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, } } - pub fn update( + pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + policy_id: impl Into, if_match: impl Into, subscription_id: impl Into, - ) -> update::Builder { - update::Builder { + ) -> delete::Builder { + delete::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - parameters: parameters.into(), + policy_id: policy_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -13974,16 +22253,95 @@ pub mod sign_up_settings { &self, resource_group_name: impl Into, service_name: impl Into, + policy_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(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), } } } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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, + } + impl Builder { + 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/{}/policies", + 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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match 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)?; + 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; #[derive(Debug, thiserror :: Error)] @@ -14013,17 +22371,24 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) policy_id: String, pub(crate) subscription_id: String, + pub(crate) format: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.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/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -14035,6 +22400,9 @@ pub mod sign_up_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -14043,7 +22411,7 @@ pub mod sign_up_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSignupSettings = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -14063,6 +22431,11 @@ pub mod sign_up_settings { } pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -14090,7 +22463,8 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSignupSettings, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -14099,14 +22473,15 @@ pub mod sign_up_settings { self.if_match = Some(if_match.into()); self } - 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.ApiManagement/service/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -14128,11 +22503,17 @@ pub mod sign_up_settings { let 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::PolicyContract = + 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::PortalSignupSettings = + let rsp_value: models::PolicyContract = 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)?; @@ -14148,8 +22529,13 @@ pub mod sign_up_settings { } } } - pub mod update { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -14177,23 +22563,24 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSignupSettings, + pub(crate) policy_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<(), Error>> { + 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/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14201,15 +22588,15 @@ pub mod sign_up_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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.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::NO_CONTENT => Ok(()), + 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 = @@ -14253,17 +22640,19 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) policy_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/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -14297,84 +22686,26 @@ pub mod sign_up_settings { } } } -pub mod delegation_settings { +pub mod policy_description { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn get( - &self, - resource_group_name: impl Into, - service_name: 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(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - 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(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - parameters: parameters.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, - 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(), - subscription_id: subscription_id.into(), - } - } - pub fn list_secrets( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { + ) -> 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(), + scope: None, } } } - pub mod get { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14404,12 +22735,19 @@ pub mod delegation_settings { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) subscription_id: String, + pub(crate) scope: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn scope(mut self, scope: impl Into) -> Self { + self.scope = Some(scope.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/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policyDescriptions", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -14425,6 +22763,9 @@ pub mod delegation_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); + if let Some(scope) = &self.scope { + url.query_pairs_mut().append_pair("scope", scope); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -14433,7 +22774,7 @@ pub mod delegation_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalDelegationSettings = + let rsp_value: models::PolicyDescriptionCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -14451,7 +22792,72 @@ pub mod delegation_settings { } } } - pub mod create_or_update { +} +pub mod sign_in_settings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + service_name: 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(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + 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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.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, + 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(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14480,19 +22886,13 @@ pub mod delegation_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalDelegationSettings, 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> { + 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/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -14500,7 +22900,7 @@ pub mod delegation_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14508,11 +22908,7 @@ pub mod delegation_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -14520,7 +22916,7 @@ pub mod delegation_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalDelegationSettings = + let rsp_value: models::PortalSigninSettings = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -14538,7 +22934,7 @@ pub mod delegation_settings { } } } - pub mod update { + pub mod create_or_update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14567,15 +22963,19 @@ pub mod delegation_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalDelegationSettings, - pub(crate) if_match: String, + pub(crate) parameters: models::PortalSigninSettings, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -14583,7 +22983,7 @@ pub mod delegation_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14593,13 +22993,20 @@ pub mod delegation_settings { url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); 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.header("If-Match", &self.if_match); + 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::NO_CONTENT => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalSigninSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -14614,7 +23021,7 @@ pub mod delegation_settings { } } } - pub mod get_entity_tag { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14643,13 +23050,15 @@ pub mod delegation_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) parameters: models::PortalSigninSettings, + pub(crate) if_match: 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/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -14657,7 +23066,7 @@ pub mod delegation_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14665,13 +23074,15 @@ pub mod delegation_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => Ok(()), + 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::ErrorResponse = @@ -14686,7 +23097,7 @@ pub mod delegation_settings { } } } - pub mod list_secrets { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14718,14 +23129,18 @@ pub mod delegation_settings { 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<(), Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", + 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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14734,18 +23149,12 @@ pub mod delegation_settings { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); 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::PortalSettingValidationKeyContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -14761,40 +23170,20 @@ pub mod delegation_settings { } } } -pub mod product { +pub mod sign_up_settings { use super::models; 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, - expand_groups: None, - tags: None, - } - } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - product_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(), - product_id: product_id.into(), subscription_id: subscription_id.into(), } } @@ -14802,15 +23191,13 @@ pub mod product { &self, resource_group_name: impl Into, service_name: impl Into, - product_id: impl Into, - parameters: 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(), - product_id: product_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -14820,8 +23207,7 @@ pub mod product { &self, resource_group_name: impl Into, service_name: impl Into, - product_id: impl Into, - parameters: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -14829,64 +23215,190 @@ pub mod product { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - product_id: product_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_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(), - product_id: product_id.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - delete_subscriptions: None, - } - } pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, - product_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(), - product_id: product_id.into(), subscription_id: subscription_id.into(), } } - pub fn list_by_tags( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> list_by_tags::Builder { - list_by_tags::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, - include_not_tagged_products: None, + } + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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, + } + impl Builder { + 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/{}/portalsettings/signup", + 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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalSignupSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) parameters: models::PortalSignupSettings, + 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/{}/portalsettings/signup", + 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", "2019-12-01-preview"); + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalSignupSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_service { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14915,38 +23427,15 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) parameters: models::PortalSignupSettings, + pub(crate) if_match: String, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, - pub(crate) expand_groups: Option, - pub(crate) tags: 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 expand_groups(mut self, expand_groups: bool) -> Self { - self.expand_groups = Some(expand_groups); - self - } - pub fn tags(mut self, tags: impl Into) -> Self { - self.tags = Some(tags.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/products", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -14954,7 +23443,7 @@ pub mod product { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14962,33 +23451,15 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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()); - } - if let Some(expand_groups) = &self.expand_groups { - url.query_pairs_mut().append_pair("expandGroups", &expand_groups.to_string()); - } - if let Some(tags) = &self.tags { - url.query_pairs_mut().append_pair("tags", tags); - } - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProductCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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::ErrorResponse = @@ -15003,7 +23474,7 @@ pub mod product { } } } - pub mod get { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -15032,23 +23503,21 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15062,12 +23531,7 @@ pub mod product { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProductContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -15082,13 +23546,86 @@ pub mod product { } } } - pub mod create_or_update { - use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ProductContract), - Ok200(models::ProductContract), +} +pub mod delegation_settings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + service_name: 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(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + 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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.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, + 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(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } } + } + pub mod get { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15116,29 +23653,21 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) parameters: models::ProductContract, 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> { + 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15146,27 +23675,17 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ProductContract = - 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::ProductContract = + let rsp_value: models::PortalDelegationSettings = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -15182,7 +23701,7 @@ pub mod product { } } } - pub mod update { + pub mod create_or_update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -15211,25 +23730,27 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) parameters: models::ProductUpdateParameters, - pub(crate) if_match: String, + pub(crate) parameters: models::PortalDelegationSettings, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15239,13 +23760,20 @@ pub mod product { url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); 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.header("If-Match", &self.if_match); + 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::NO_CONTENT => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalDelegationSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -15260,13 +23788,8 @@ pub mod product { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } + pub mod update { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15294,29 +23817,23 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, + pub(crate) parameters: models::PortalDelegationSettings, pub(crate) if_match: String, pub(crate) subscription_id: String, - pub(crate) delete_subscriptions: Option, } impl Builder { - pub fn delete_subscriptions(mut self, delete_subscriptions: bool) -> Self { - self.delete_subscriptions = Some(delete_subscriptions); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15324,19 +23841,15 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); + 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.header("If-Match", &self.if_match); - if let Some(delete_subscriptions) = &self.delete_subscriptions { - url.query_pairs_mut() - .append_pair("deleteSubscriptions", &delete_subscriptions.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::NO_CONTENT => Ok(Response::NoContent204), + 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::ErrorResponse = @@ -15380,19 +23893,17 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &self.service_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -15425,7 +23936,7 @@ pub mod product { } } } - pub mod list_by_tags { + pub mod list_secrets { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -15455,40 +23966,16 @@ pub mod product { 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, - pub(crate) include_not_tagged_products: 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 include_not_tagged_products(mut self, include_not_tagged_products: bool) -> Self { - self.include_not_tagged_products = Some(include_not_tagged_products); - self - } - 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.ApiManagement/service/{}/productsByTags", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation/listSecrets" , 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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15496,20 +23983,8 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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()); - } - if let Some(include_not_tagged_products) = &self.include_not_tagged_products { - url.query_pairs_mut() - .append_pair("includeNotTaggedProducts", &include_not_tagged_products.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)?; @@ -15517,7 +23992,7 @@ pub mod product { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagResourceCollection = + let rsp_value: models::PortalSettingValidationKeyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -15536,26 +24011,41 @@ pub mod product { } } } -pub mod product_api { +pub mod product { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_product( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - product_id: impl Into, subscription_id: impl Into, - ) -> list_by_product::Builder { - list_by_product::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - product_id: product_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, + expand_groups: None, + tags: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_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(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), } } pub fn create_or_update( @@ -15563,7 +24053,7 @@ pub mod product_api { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - api_id: impl Into, + parameters: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -15571,7 +24061,27 @@ pub mod product_api { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - api_id: api_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } @@ -15580,7 +24090,7 @@ pub mod product_api { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - api_id: impl Into, + if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { delete::Builder { @@ -15588,138 +24098,46 @@ pub mod product_api { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - api_id: api_id.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), + delete_subscriptions: None, } } - pub fn check_entity_exists( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - api_id: impl Into, subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - api_id: api_id.into(), subscription_id: subscription_id.into(), } } - } - pub mod list_by_product { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: 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/{}/products/{}/apis", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_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", "2019-12-01-preview"); - 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::ApiCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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 list_by_tags( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_tags::Builder { + list_by_tags::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, + include_not_tagged_products: None, } } } - pub mod create_or_update { + pub mod list_by_service { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ApiContract), - Ok200(models::ApiContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15747,25 +24165,46 @@ pub mod product_api { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) api_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) expand_groups: Option, + pub(crate) tags: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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 expand_groups(mut self, expand_groups: bool) -> Self { + self.expand_groups = Some(expand_groups); + self + } + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.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/{}/products/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.api_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15773,23 +24212,32 @@ pub mod product_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); + 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()); + } + if let Some(expand_groups) = &self.expand_groups { + url.query_pairs_mut().append_pair("expandGroups", &expand_groups.to_string()); + } + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ApiContract = - 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::ApiContract = + let rsp_value: models::ProductCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -15805,13 +24253,8 @@ pub mod product_api { } } } - pub mod delete { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15840,24 +24283,22 @@ pub mod product_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) api_id: String, 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.ApiManagement/service/{}/products/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.api_id + &self.product_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15871,175 +24312,33 @@ pub mod product_api { let rsp = 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 => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ErrorResponse = + let rsp_value: models::ProductContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) + Ok(rsp_value) } - } - }) - } - } - } - pub mod check_entity_exists { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: String, - pub(crate) api_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/{}/products/{}/apis/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.api_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", "2019-12-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let 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::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 product_group { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - subscription_id: impl Into, - ) -> list_by_product::Builder { - list_by_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - group_id: 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(), - product_id: product_id.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - group_id: 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(), - product_id: product_id.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn check_entity_exists( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - group_id: impl Into, - subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) } } } - pub mod list_by_product { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ProductContract), + Ok200(models::ProductContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -16068,28 +24367,19 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, + pub(crate) parameters: models::ProductContract, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, + pub(crate) if_match: 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); + 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> { + 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/{}/products/{}/groups", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -16098,7 +24388,7 @@ pub mod product_group { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16106,26 +24396,27 @@ pub mod product_group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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()); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ProductContract = + 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::GroupCollection = + let rsp_value: models::ProductContract = 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)?; @@ -16141,13 +24432,8 @@ pub mod product_group { } } } - pub mod create_or_update { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::GroupContract), - Ok200(models::GroupContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -16176,24 +24462,24 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) group_id: String, + pub(crate) parameters: models::ProductUpdateParameters, + pub(crate) if_match: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.group_id + &self.product_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16201,24 +24487,15 @@ pub mod product_group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::GroupContract = - 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::GroupContract = - 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(()), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -16268,20 +24545,24 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) group_id: String, + pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) delete_subscriptions: Option, } impl Builder { + pub fn delete_subscriptions(mut self, delete_subscriptions: bool) -> Self { + self.delete_subscriptions = Some(delete_subscriptions); + 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/{}/products/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.group_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -16293,6 +24574,11 @@ pub mod product_group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + if let Some(delete_subscriptions) = &self.delete_subscriptions { + url.query_pairs_mut() + .append_pair("deleteSubscriptions", &delete_subscriptions.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)?; @@ -16315,7 +24601,7 @@ pub mod product_group { } } } - pub mod check_entity_exists { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -16345,20 +24631,18 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) group_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/{}/products/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.group_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -16376,7 +24660,7 @@ pub mod product_group { let 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(()), + 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 = @@ -16391,31 +24675,7 @@ pub mod product_group { } } } -} -pub mod product_subscriptions { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - } - pub mod list { + pub mod list_by_tags { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -16444,11 +24704,11 @@ pub mod product_subscriptions { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, + pub(crate) include_not_tagged_products: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -16463,15 +24723,18 @@ pub mod product_subscriptions { self.skip = Some(skip); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn include_not_tagged_products(mut self, include_not_tagged_products: bool) -> Self { + self.include_not_tagged_products = Some(include_not_tagged_products); + 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/{}/products/{}/subscriptions", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/productsByTags", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &self.service_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -16492,6 +24755,10 @@ pub mod product_subscriptions { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } + if let Some(include_not_tagged_products) = &self.include_not_tagged_products { + url.query_pairs_mut() + .append_pair("includeNotTaggedProducts", &include_not_tagged_products.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)?; @@ -16500,7 +24767,7 @@ pub mod product_subscriptions { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::SubscriptionCollection = + let rsp_value: models::TagResourceCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -16519,7 +24786,7 @@ pub mod product_subscriptions { } } } -pub mod product_policy { +pub mod product_api { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -16536,24 +24803,9 @@ pub mod product_policy { service_name: service_name.into(), product_id: product_id.into(), subscription_id: subscription_id.into(), - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - policy_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(), - product_id: product_id.into(), - policy_id: policy_id.into(), - subscription_id: subscription_id.into(), - format: None, + filter: None, + top: None, + skip: None, } } pub fn create_or_update( @@ -16561,8 +24813,7 @@ pub mod product_policy { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - policy_id: impl Into, - parameters: impl Into, + api_id: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -16570,10 +24821,8 @@ pub mod product_policy { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - policy_id: policy_id.into(), - parameters: parameters.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), - if_match: None, } } pub fn delete( @@ -16581,118 +24830,37 @@ pub mod product_policy { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - policy_id: impl Into, - if_match: impl Into, + api_id: 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(), - product_id: product_id.into(), - policy_id: policy_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, - product_id: impl Into, - policy_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(), - product_id: product_id.into(), - policy_id: policy_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_product { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: String, - pub(crate) subscription_id: String, + product_id: product_id.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } } - impl Builder { - 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/{}/products/{}/policies", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_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", "2019-12-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match 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)?; - 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 check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), } } } - pub mod get { + pub mod list_by_product { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -16722,25 +24890,33 @@ pub mod product_policy { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) policy_id: String, pub(crate) subscription_id: String, - pub(crate) format: Option, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn format(mut self, format: impl Into) -> Self { - self.format = Some(format.into()); + 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> { + 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/{}/products/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.policy_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -16752,8 +24928,14 @@ pub mod product_policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - if let Some(format) = &self.format { - url.query_pairs_mut().append_pair("format", format); + 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()); @@ -16763,7 +24945,7 @@ pub mod product_policy { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PolicyContract = + let rsp_value: models::ApiCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -16785,8 +24967,8 @@ pub mod product_policy { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::PolicyContract), - Ok200(models::PolicyContract), + Created201(models::ApiContract), + Ok200(models::ApiContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -16816,26 +24998,20 @@ pub mod product_policy { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) policy_id: String, - pub(crate) parameters: models::PolicyContract, + pub(crate) api_id: String, 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/{}/products/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.policy_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -16847,11 +25023,7 @@ pub mod product_policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - if let Some(if_match) = &self.if_match { - req_builder = req_builder.header("If-Match", if_match); - } - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -16859,13 +25031,13 @@ pub mod product_policy { 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::PolicyContract = + let rsp_value: models::ApiContract = 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::PolicyContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -16918,21 +25090,20 @@ pub mod product_policy { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) policy_id: String, - pub(crate) if_match: String, + pub(crate) api_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/{}/products/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.policy_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -16944,7 +25115,6 @@ pub mod product_policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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)?; @@ -16967,7 +25137,7 @@ pub mod product_policy { } } } - pub mod get_entity_tag { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -16996,210 +25166,90 @@ pub mod product_policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) policy_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/{}/products/{}/policies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.policy_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", "2019-12-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = 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 tag { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - subscription_id: impl Into, - ) -> list_by_product::Builder { - list_by_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - pub fn get_by_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - tag_id: impl Into, - subscription_id: impl Into, - ) -> get_by_product::Builder { - get_by_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn assign_to_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - tag_id: impl Into, - subscription_id: impl Into, - ) -> assign_to_product::Builder { - assign_to_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn detach_from_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - tag_id: impl Into, - subscription_id: impl Into, - ) -> detach_from_product::Builder { - detach_from_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), + pub(crate) product_id: String, + pub(crate) api_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/{}/products/{}/apis/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.api_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", "2019-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::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 get_entity_state_by_product( + } +} +pub mod product_group { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_product( &self, resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - tag_id: impl Into, subscription_id: impl Into, - ) -> get_entity_state_by_product::Builder { - get_entity_state_by_product::Builder { + ) -> list_by_product::Builder { + list_by_product::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), - } - } - 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, - scope: None, - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - tag_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(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - tag_id: impl Into, - parameters: impl Into, + product_id: impl Into, + group_id: 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(), - tag_id: tag_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - tag_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - tag_id: tag_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), + product_id: product_id.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -17207,31 +25257,33 @@ pub mod tag { &self, resource_group_name: impl Into, service_name: impl Into, - tag_id: impl Into, - if_match: impl Into, + product_id: impl Into, + group_id: 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(), - tag_id: tag_id.into(), - if_match: if_match.into(), + product_id: product_id.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } - pub fn get_entity_state( + pub fn check_entity_exists( &self, resource_group_name: impl Into, service_name: impl Into, - tag_id: impl Into, + product_id: impl Into, + group_id: impl Into, subscription_id: impl Into, - ) -> get_entity_state::Builder { - get_entity_state::Builder { + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - tag_id: tag_id.into(), + product_id: product_id.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -17284,10 +25336,10 @@ pub mod tag { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/products/{}/tags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -17321,88 +25373,7 @@ pub mod tag { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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_product { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: String, - pub(crate) tag_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/{}/products/{}/tags/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.tag_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", "2019-12-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagContract = + let rsp_value: models::GroupCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -17420,12 +25391,12 @@ pub mod tag { } } } - pub mod assign_to_product { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::TagContract), - Ok200(models::TagContract), + Created201(models::GroupContract), + Ok200(models::GroupContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17455,20 +25426,20 @@ pub mod tag { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) tag_id: String, + pub(crate) group_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/{}/products/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.tag_id + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -17488,13 +25459,13 @@ pub mod tag { 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::TagContract = + let rsp_value: models::GroupContract = 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::TagContract = + let rsp_value: models::GroupContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -17512,7 +25483,7 @@ pub mod tag { } } } - pub mod detach_from_product { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { @@ -17547,20 +25518,20 @@ pub mod tag { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) tag_id: String, + pub(crate) group_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/{}/products/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.tag_id + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -17594,7 +25565,7 @@ pub mod tag { } } } - pub mod get_entity_state_by_product { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17624,20 +25595,20 @@ pub mod tag { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) tag_id: String, + pub(crate) group_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/{}/products/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.tag_id + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -17655,7 +25626,7 @@ pub mod tag { let rsp = 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(()), + 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::ErrorResponse = @@ -17670,7 +25641,31 @@ pub mod tag { } } } - pub mod list_by_service { +} +pub mod product_subscriptions { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17699,11 +25694,11 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) product_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, - pub(crate) scope: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -17718,18 +25713,15 @@ pub mod tag { self.skip = Some(skip); self } - pub fn scope(mut self, scope: impl Into) -> Self { - self.scope = Some(scope.into()); - self - } - 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.ApiManagement/service/{}/tags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/subscriptions", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -17750,9 +25742,6 @@ pub mod tag { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } - if let Some(scope) = &self.scope { - url.query_pairs_mut().append_pair("scope", scope); - } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -17761,7 +25750,7 @@ pub mod tag { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagCollection = + let rsp_value: models::SubscriptionCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -17779,7 +25768,102 @@ pub mod tag { } } } - pub mod get { +} +pub mod product_policy { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list_by_product::Builder { + list_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + format: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_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, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_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, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_product { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17808,19 +25892,19 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, + pub(crate) product_id: String, 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.ApiManagement/service/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -17840,7 +25924,7 @@ pub mod tag { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagContract = + let rsp_value: models::PolicyCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -17858,13 +25942,8 @@ pub mod tag { } } } - pub mod create_or_update { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::TagContract), - Ok200(models::TagContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -17892,29 +25971,30 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, - pub(crate) parameters: models::TagCreateUpdateParameters, + pub(crate) product_id: String, + pub(crate) policy_id: String, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) format: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.into()); self } - 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.ApiManagement/service/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17922,27 +26002,20 @@ pub mod tag { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); - 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); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::TagContract = - 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::TagContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -17958,8 +26031,13 @@ pub mod tag { } } } - pub mod update { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -17987,25 +26065,31 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, - pub(crate) parameters: models::TagCreateUpdateParameters, - pub(crate) if_match: String, + pub(crate) product_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18013,15 +26097,28 @@ pub mod tag { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-12-01-preview"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } 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.header("If-Match", &self.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::NO_CONTENT => Ok(()), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + 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::PolicyContract = + 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 = @@ -18070,7 +26167,8 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, + pub(crate) product_id: String, + pub(crate) policy_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -18078,12 +26176,13 @@ pub mod tag { 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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -18118,7 +26217,7 @@ pub mod tag { } } } - pub mod get_entity_state { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18147,19 +26246,21 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, + pub(crate) product_id: String, + pub(crate) policy_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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); diff --git a/services/mgmt/apimanagement/src/package_preview_2020_06/operations.rs b/services/mgmt/apimanagement/src/package_preview_2020_06/operations.rs index 0ca03f2418..13ef8751a1 100644 --- a/services/mgmt/apimanagement/src/package_preview_2020_06/operations.rs +++ b/services/mgmt/apimanagement/src/package_preview_2020_06/operations.rs @@ -77,9 +77,21 @@ impl Client { pub fn api(&self) -> api::Client { api::Client(self.clone()) } + pub fn api_diagnostic(&self) -> api_diagnostic::Client { + api_diagnostic::Client(self.clone()) + } pub fn api_export(&self) -> api_export::Client { api_export::Client(self.clone()) } + pub fn api_issue(&self) -> api_issue::Client { + api_issue::Client(self.clone()) + } + pub fn api_issue_attachment(&self) -> api_issue_attachment::Client { + api_issue_attachment::Client(self.clone()) + } + pub fn api_issue_comment(&self) -> api_issue_comment::Client { + api_issue_comment::Client(self.clone()) + } pub fn api_management_operations(&self) -> api_management_operations::Client { api_management_operations::Client(self.clone()) } @@ -92,6 +104,30 @@ impl Client { pub fn api_management_skus(&self) -> api_management_skus::Client { api_management_skus::Client(self.clone()) } + pub fn api_operation(&self) -> api_operation::Client { + api_operation::Client(self.clone()) + } + pub fn api_operation_policy(&self) -> api_operation_policy::Client { + api_operation_policy::Client(self.clone()) + } + pub fn api_policy(&self) -> api_policy::Client { + api_policy::Client(self.clone()) + } + pub fn api_product(&self) -> api_product::Client { + api_product::Client(self.clone()) + } + pub fn api_release(&self) -> api_release::Client { + api_release::Client(self.clone()) + } + pub fn api_revision(&self) -> api_revision::Client { + api_revision::Client(self.clone()) + } + pub fn api_schema(&self) -> api_schema::Client { + api_schema::Client(self.clone()) + } + pub fn api_tag_description(&self) -> api_tag_description::Client { + api_tag_description::Client(self.clone()) + } pub fn api_version_set(&self) -> api_version_set::Client { api_version_set::Client(self.clone()) } @@ -170,6 +206,9 @@ impl Client { pub fn open_id_connect_provider(&self) -> open_id_connect_provider::Client { open_id_connect_provider::Client(self.clone()) } + pub fn operation(&self) -> operation::Client { + operation::Client(self.clone()) + } pub fn policy(&self) -> policy::Client { policy::Client(self.clone()) } @@ -259,6 +298,152 @@ pub enum Error { #[error(transparent)] ApiExport_Get(#[from] api_export::get::Error), #[error(transparent)] + Api_ListByService(#[from] api::list_by_service::Error), + #[error(transparent)] + Api_Get(#[from] api::get::Error), + #[error(transparent)] + Api_CreateOrUpdate(#[from] api::create_or_update::Error), + #[error(transparent)] + Api_Update(#[from] api::update::Error), + #[error(transparent)] + Api_Delete(#[from] api::delete::Error), + #[error(transparent)] + Api_GetEntityTag(#[from] api::get_entity_tag::Error), + #[error(transparent)] + ApiRevision_ListByService(#[from] api_revision::list_by_service::Error), + #[error(transparent)] + ApiRelease_ListByService(#[from] api_release::list_by_service::Error), + #[error(transparent)] + ApiRelease_Get(#[from] api_release::get::Error), + #[error(transparent)] + ApiRelease_CreateOrUpdate(#[from] api_release::create_or_update::Error), + #[error(transparent)] + ApiRelease_Update(#[from] api_release::update::Error), + #[error(transparent)] + ApiRelease_Delete(#[from] api_release::delete::Error), + #[error(transparent)] + ApiRelease_GetEntityTag(#[from] api_release::get_entity_tag::Error), + #[error(transparent)] + ApiOperation_ListByApi(#[from] api_operation::list_by_api::Error), + #[error(transparent)] + ApiOperation_Get(#[from] api_operation::get::Error), + #[error(transparent)] + ApiOperation_CreateOrUpdate(#[from] api_operation::create_or_update::Error), + #[error(transparent)] + ApiOperation_Update(#[from] api_operation::update::Error), + #[error(transparent)] + ApiOperation_Delete(#[from] api_operation::delete::Error), + #[error(transparent)] + ApiOperation_GetEntityTag(#[from] api_operation::get_entity_tag::Error), + #[error(transparent)] + ApiOperationPolicy_ListByOperation(#[from] api_operation_policy::list_by_operation::Error), + #[error(transparent)] + ApiOperationPolicy_Get(#[from] api_operation_policy::get::Error), + #[error(transparent)] + ApiOperationPolicy_CreateOrUpdate(#[from] api_operation_policy::create_or_update::Error), + #[error(transparent)] + ApiOperationPolicy_Delete(#[from] api_operation_policy::delete::Error), + #[error(transparent)] + ApiOperationPolicy_GetEntityTag(#[from] api_operation_policy::get_entity_tag::Error), + #[error(transparent)] + Tag_ListByOperation(#[from] tag::list_by_operation::Error), + #[error(transparent)] + Tag_GetByOperation(#[from] tag::get_by_operation::Error), + #[error(transparent)] + Tag_AssignToOperation(#[from] tag::assign_to_operation::Error), + #[error(transparent)] + Tag_DetachFromOperation(#[from] tag::detach_from_operation::Error), + #[error(transparent)] + Tag_GetEntityStateByOperation(#[from] tag::get_entity_state_by_operation::Error), + #[error(transparent)] + ApiProduct_ListByApis(#[from] api_product::list_by_apis::Error), + #[error(transparent)] + ApiPolicy_ListByApi(#[from] api_policy::list_by_api::Error), + #[error(transparent)] + ApiPolicy_Get(#[from] api_policy::get::Error), + #[error(transparent)] + ApiPolicy_CreateOrUpdate(#[from] api_policy::create_or_update::Error), + #[error(transparent)] + ApiPolicy_Delete(#[from] api_policy::delete::Error), + #[error(transparent)] + ApiPolicy_GetEntityTag(#[from] api_policy::get_entity_tag::Error), + #[error(transparent)] + ApiSchema_ListByApi(#[from] api_schema::list_by_api::Error), + #[error(transparent)] + ApiSchema_Get(#[from] api_schema::get::Error), + #[error(transparent)] + ApiSchema_CreateOrUpdate(#[from] api_schema::create_or_update::Error), + #[error(transparent)] + ApiSchema_Delete(#[from] api_schema::delete::Error), + #[error(transparent)] + ApiSchema_GetEntityTag(#[from] api_schema::get_entity_tag::Error), + #[error(transparent)] + ApiDiagnostic_ListByService(#[from] api_diagnostic::list_by_service::Error), + #[error(transparent)] + ApiDiagnostic_Get(#[from] api_diagnostic::get::Error), + #[error(transparent)] + ApiDiagnostic_CreateOrUpdate(#[from] api_diagnostic::create_or_update::Error), + #[error(transparent)] + ApiDiagnostic_Update(#[from] api_diagnostic::update::Error), + #[error(transparent)] + ApiDiagnostic_Delete(#[from] api_diagnostic::delete::Error), + #[error(transparent)] + ApiDiagnostic_GetEntityTag(#[from] api_diagnostic::get_entity_tag::Error), + #[error(transparent)] + ApiIssue_ListByService(#[from] api_issue::list_by_service::Error), + #[error(transparent)] + ApiIssue_Get(#[from] api_issue::get::Error), + #[error(transparent)] + ApiIssue_CreateOrUpdate(#[from] api_issue::create_or_update::Error), + #[error(transparent)] + ApiIssue_Update(#[from] api_issue::update::Error), + #[error(transparent)] + ApiIssue_Delete(#[from] api_issue::delete::Error), + #[error(transparent)] + ApiIssue_GetEntityTag(#[from] api_issue::get_entity_tag::Error), + #[error(transparent)] + ApiIssueComment_ListByService(#[from] api_issue_comment::list_by_service::Error), + #[error(transparent)] + ApiIssueComment_Get(#[from] api_issue_comment::get::Error), + #[error(transparent)] + ApiIssueComment_CreateOrUpdate(#[from] api_issue_comment::create_or_update::Error), + #[error(transparent)] + ApiIssueComment_Delete(#[from] api_issue_comment::delete::Error), + #[error(transparent)] + ApiIssueComment_GetEntityTag(#[from] api_issue_comment::get_entity_tag::Error), + #[error(transparent)] + ApiIssueAttachment_ListByService(#[from] api_issue_attachment::list_by_service::Error), + #[error(transparent)] + ApiIssueAttachment_Get(#[from] api_issue_attachment::get::Error), + #[error(transparent)] + ApiIssueAttachment_CreateOrUpdate(#[from] api_issue_attachment::create_or_update::Error), + #[error(transparent)] + ApiIssueAttachment_Delete(#[from] api_issue_attachment::delete::Error), + #[error(transparent)] + ApiIssueAttachment_GetEntityTag(#[from] api_issue_attachment::get_entity_tag::Error), + #[error(transparent)] + ApiTagDescription_ListByService(#[from] api_tag_description::list_by_service::Error), + #[error(transparent)] + ApiTagDescription_Get(#[from] api_tag_description::get::Error), + #[error(transparent)] + ApiTagDescription_CreateOrUpdate(#[from] api_tag_description::create_or_update::Error), + #[error(transparent)] + ApiTagDescription_Delete(#[from] api_tag_description::delete::Error), + #[error(transparent)] + ApiTagDescription_GetEntityTag(#[from] api_tag_description::get_entity_tag::Error), + #[error(transparent)] + Tag_ListByApi(#[from] tag::list_by_api::Error), + #[error(transparent)] + Tag_GetByApi(#[from] tag::get_by_api::Error), + #[error(transparent)] + Tag_AssignToApi(#[from] tag::assign_to_api::Error), + #[error(transparent)] + Tag_DetachFromApi(#[from] tag::detach_from_api::Error), + #[error(transparent)] + Tag_GetEntityStateByApi(#[from] tag::get_entity_state_by_api::Error), + #[error(transparent)] + Operation_ListByTags(#[from] operation::list_by_tags::Error), + #[error(transparent)] Api_ListByTags(#[from] api::list_by_tags::Error), #[error(transparent)] ApiVersionSet_ListByService(#[from] api_version_set::list_by_service::Error), @@ -887,6 +1072,109 @@ pub mod api { use super::models; 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, + tags: None, + expand_api_version_set: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + delete_revisions: None, + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } pub fn list_by_tags( &self, resource_group_name: impl Into, @@ -905,7 +1193,7 @@ pub mod api { } } } - pub mod list_by_tags { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -938,7 +1226,8 @@ pub mod api { pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, - pub(crate) include_not_tagged_apis: Option, + pub(crate) tags: Option, + pub(crate) expand_api_version_set: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -953,14 +1242,18 @@ pub mod api { self.skip = Some(skip); self } - pub fn include_not_tagged_apis(mut self, include_not_tagged_apis: bool) -> Self { - self.include_not_tagged_apis = Some(include_not_tagged_apis); + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.into()); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn expand_api_version_set(mut self, expand_api_version_set: bool) -> Self { + self.expand_api_version_set = Some(expand_api_version_set); + 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/{}/apisByTags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -985,9 +1278,12 @@ pub mod api { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } - if let Some(include_not_tagged_apis) = &self.include_not_tagged_apis { + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } + if let Some(expand_api_version_set) = &self.expand_api_version_set { url.query_pairs_mut() - .append_pair("includeNotTaggedApis", &include_not_tagged_apis.to_string()); + .append_pair("expandApiVersionSet", &expand_api_version_set.to_string()); } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); @@ -997,7 +1293,7 @@ pub mod api { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagResourceCollection = + let rsp_value: models::ApiCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1015,255 +1311,48 @@ pub mod api { } } } -} -pub mod api_version_set { - use super::models; - 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, - version_set_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(), - version_set_id: version_set_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - version_set_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(), - version_set_id: version_set_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - version_set_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - version_set_id: version_set_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - version_set_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(), - version_set_id: version_set_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, - version_set_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(), - version_set_id: version_set_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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/{}/apiVersionSets", - 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", "2020-06-01-preview"); - 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::ApiVersionSetCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_id: String, + pub(crate) api_id: String, 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.ApiManagement/service/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1283,7 +1372,7 @@ pub mod api_version_set { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiVersionSetContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1305,8 +1394,9 @@ pub mod api_version_set { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::ApiVersionSetContract), - Ok200(models::ApiVersionSetContract), + Created201(models::ApiContract), + Accepted202, + Ok200(models::ApiContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1335,8 +1425,8 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, - pub(crate) parameters: models::ApiVersionSetContract, + pub(crate) api_id: String, + pub(crate) parameters: models::ApiCreateOrUpdateParameter, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -1348,12 +1438,12 @@ pub mod api_version_set { 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/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1377,13 +1467,14 @@ pub mod api_version_set { 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::ApiVersionSetContract = + let rsp_value: models::ApiContract = 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), http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiVersionSetContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -1430,21 +1521,21 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, - pub(crate) parameters: models::ApiVersionSetUpdateParameters, + pub(crate) api_id: String, + pub(crate) parameters: models::ApiUpdateContract, pub(crate) if_match: String, 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.ApiManagement/service/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1466,7 +1557,7 @@ pub mod api_version_set { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiVersionSetContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1518,20 +1609,25 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, + pub(crate) api_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) delete_revisions: Option, } impl Builder { + pub fn delete_revisions(mut self, delete_revisions: bool) -> Self { + self.delete_revisions = Some(delete_revisions); + 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/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1543,6 +1639,9 @@ pub mod api_version_set { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + if let Some(delete_revisions) = &self.delete_revisions { + url.query_pairs_mut().append_pair("deleteRevisions", &delete_revisions.to_string()); + } 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()); @@ -1595,19 +1694,19 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, + pub(crate) api_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/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1640,128 +1739,7 @@ pub mod api_version_set { } } } -} -pub mod authorization_server { - use super::models; - 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, - authsid: 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(), - authsid: authsid.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: 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(), - authsid: authsid.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - authsid: authsid.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: 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(), - authsid: authsid.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, - authsid: 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(), - authsid: authsid.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_secrets( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: impl Into, - subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - authsid: authsid.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod list_by_tags { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1794,6 +1772,7 @@ pub mod authorization_server { pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, + pub(crate) include_not_tagged_apis: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -1808,12 +1787,14 @@ pub mod authorization_server { self.skip = Some(skip); self } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn include_not_tagged_apis(mut self, include_not_tagged_apis: bool) -> Self { + self.include_not_tagged_apis = Some(include_not_tagged_apis); + 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/{}/authorizationServers", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apisByTags", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -1838,6 +1819,10 @@ pub mod authorization_server { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } + if let Some(include_not_tagged_apis) = &self.include_not_tagged_apis { + url.query_pairs_mut() + .append_pair("includeNotTaggedApis", &include_not_tagged_apis.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)?; @@ -1846,7 +1831,7 @@ pub mod authorization_server { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerCollection = + let rsp_value: models::TagResourceCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1864,7 +1849,31 @@ pub mod authorization_server { } } } - pub mod get { +} +pub mod api_revision { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1893,21 +1902,34 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, + pub(crate) api_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/revisions", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1919,6 +1941,15 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + 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)?; @@ -1927,7 +1958,7 @@ pub mod authorization_server { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerContract = + let rsp_value: models::ApiRevisionCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1945,63 +1976,185 @@ pub mod authorization_server { } } } - pub mod create_or_update { - use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::AuthorizationServerContract), - Ok200(models::AuthorizationServerContract), +} +pub mod api_release { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } } - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_id.into(), + subscription_id: subscription_id.into(), + } } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + release_id: release_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_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, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: String, - pub(crate) parameters: models::AuthorizationServerContract, + pub(crate) api_id: String, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + 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> { + 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2009,27 +2162,26 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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); + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerContract = - 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::AuthorizationServerContract = + let rsp_value: models::ApiReleaseCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -2045,7 +2197,7 @@ pub mod authorization_server { } } } - pub mod update { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2074,27 +2226,25 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, - pub(crate) parameters: models::AuthorizationServerUpdateContract, - pub(crate) if_match: String, + pub(crate) api_id: String, + pub(crate) release_id: String, 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.ApiManagement/service/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2102,9 +2252,7 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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.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)?; @@ -2112,7 +2260,7 @@ pub mod authorization_server { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerContract = + let rsp_value: models::ApiReleaseContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2130,12 +2278,12 @@ pub mod authorization_server { } } } - pub mod delete { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200, - NoContent204, + Created201(models::ApiReleaseContract), + Ok200(models::ApiReleaseContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2164,24 +2312,31 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, - pub(crate) if_match: String, + pub(crate) api_id: String, + pub(crate) release_id: String, + pub(crate) parameters: models::ApiReleaseContract, 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2189,15 +2344,28 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - req_builder = req_builder.header("If-Match", &self.if_match); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiReleaseContract = + 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::ApiReleaseContract = + 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 = @@ -2212,7 +2380,7 @@ pub mod authorization_server { } } } - pub mod get_entity_tag { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2241,23 +2409,27 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, + pub(crate) api_id: String, + pub(crate) release_id: String, + pub(crate) parameters: models::ApiReleaseContract, + pub(crate) if_match: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2265,13 +2437,20 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiReleaseContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -2286,8 +2465,13 @@ pub mod authorization_server { } } } - pub mod list_secrets { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -2315,18 +2499,26 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, + pub(crate) api_id: String, + pub(crate) release_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> { + 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/{}/authorizationServers/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . authsid) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2334,19 +2526,15 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); 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::AuthorizationServerSecretsContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -2361,39 +2549,120 @@ pub mod authorization_server { } } } -} -pub mod backend { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_service( - &self, + pub mod get_entity_tag { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) release_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/{}/apis/{}/releases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.release_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_operation { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, resource_group_name: impl Into, service_name: impl Into, + api_id: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> list_by_api::Builder { + list_by_api::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, + tags: None, } } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, + api_id: impl Into, + operation_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(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), } } @@ -2401,15 +2670,17 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_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(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -2419,8 +2690,9 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -2428,7 +2700,8 @@ pub mod backend { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), @@ -2438,7 +2711,8 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, + api_id: impl Into, + operation_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -2446,7 +2720,8 @@ pub mod backend { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -2455,35 +2730,21 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, + api_id: impl Into, + operation_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(), - backend_id: backend_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn reconnect( - &self, - resource_group_name: impl Into, - service_name: impl Into, - backend_id: impl Into, - subscription_id: impl Into, - ) -> reconnect::Builder { - reconnect::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), - parameters: None, } } } - pub mod list_by_service { + pub mod list_by_api { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2512,10 +2773,12 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) api_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, + pub(crate) tags: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -2530,14 +2793,19 @@ pub mod backend { self.skip = Some(skip); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.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/{}/backends", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2558,6 +2826,9 @@ pub mod backend { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -2566,7 +2837,7 @@ pub mod backend { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackendCollection = + let rsp_value: models::OperationCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2613,19 +2884,21 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, 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.ApiManagement/service/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2645,7 +2918,7 @@ pub mod backend { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackendContract = + let rsp_value: models::OperationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2667,8 +2940,8 @@ pub mod backend { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::BackendContract), - Ok200(models::BackendContract), + Created201(models::OperationContract), + Ok200(models::OperationContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2697,8 +2970,9 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, - pub(crate) parameters: models::BackendContract, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) parameters: models::OperationContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -2710,12 +2984,13 @@ pub mod backend { 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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2739,13 +3014,13 @@ pub mod backend { 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::BackendContract = + let rsp_value: models::OperationContract = 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::BackendContract = + let rsp_value: models::OperationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -2792,21 +3067,23 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, - pub(crate) parameters: models::BackendUpdateParameters, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) parameters: models::OperationUpdateContract, pub(crate) if_match: String, 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.ApiManagement/service/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2828,7 +3105,7 @@ pub mod backend { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackendContract = + let rsp_value: models::OperationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2880,7 +3157,8 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -2888,12 +3166,13 @@ pub mod backend { 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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2957,19 +3236,21 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, + pub(crate) api_id: String, + pub(crate) operation_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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -3002,167 +3283,77 @@ pub mod backend { } } } - pub mod reconnect { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) backend_id: 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<(), Error>> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}/reconnect", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.backend_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", "2020-06-01-preview"); - 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::ACCEPTED => 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 cache { +pub mod api_operation_policy { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_service( + pub fn list_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> list_by_operation::Builder { + list_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), - top: None, - skip: None, } } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_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(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), + format: None, } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_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(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, } } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - cache_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - cache_id: cache_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -3170,7 +3361,9 @@ pub mod cache { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -3179,19 +3372,23 @@ pub mod cache { &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_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(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_service { + pub mod list_by_operation { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3220,27 +3417,21 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, pub(crate) subscription_id: String, - pub(crate) top: Option, - pub(crate) skip: Option, } impl Builder { - 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> { + 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/{}/caches", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -3252,12 +3443,6 @@ pub mod cache { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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)?; @@ -3266,7 +3451,7 @@ pub mod cache { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CacheCollection = + let rsp_value: models::PolicyCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -3313,20 +3498,20 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_id: String, pub(crate) subscription_id: String, + pub(crate) format: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3337,6 +3522,9 @@ pub mod cache { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -3345,7 +3533,7 @@ pub mod cache { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CacheContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -3367,8 +3555,8 @@ pub mod cache { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::CacheContract), - Ok200(models::CacheContract), + Created201(models::PolicyContract), + Ok200(models::PolicyContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3397,8 +3585,10 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, - pub(crate) parameters: models::CacheContract, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -3409,14 +3599,7 @@ pub mod cache { } 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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3439,13 +3622,13 @@ pub mod cache { 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::CacheContract = + let rsp_value: models::PolicyContract = 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::CacheContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -3463,89 +3646,6 @@ pub mod cache { } } } - pub mod update { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) cache_id: String, - pub(crate) parameters: models::CacheUpdateParameters, - 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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_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", "2020-06-01-preview"); - 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.header("If-Match", &self.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::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CacheContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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; #[derive(Debug)] @@ -3580,21 +3680,16 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3657,20 +3752,15 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3703,110 +3793,8351 @@ pub mod cache { } } } -pub mod certificate { +pub mod tag { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_service( + pub fn list_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> list_by_operation::Builder { + list_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, - is_key_vault_refresh_failed: None, } } - pub fn get( + pub fn get_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> get::Builder { - get::Builder { + ) -> get_by_operation::Builder { + get_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), } } - pub fn create_or_update( + pub fn assign_to_operation( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> create_or_update::Builder { - create_or_update::Builder { + ) -> assign_to_operation::Builder { + assign_to_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), - parameters: parameters.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), - if_match: None, } } - pub fn delete( + pub fn detach_from_operation( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, - if_match: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> delete::Builder { - delete::Builder { + ) -> detach_from_operation::Builder { + detach_from_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), - if_match: if_match.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), } } - pub fn get_entity_tag( + pub fn get_entity_state_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> get_entity_tag::Builder { - get_entity_tag::Builder { + ) -> get_entity_state_by_operation::Builder { + get_entity_state_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), } } - pub fn refresh_secret( + pub fn list_by_api( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, + api_id: impl Into, subscription_id: impl Into, - ) -> refresh_secret::Builder { - refresh_secret::Builder { + ) -> list_by_api::Builder { + list_by_api::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_by_api::Builder { + get_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn assign_to_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> assign_to_api::Builder { + assign_to_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn detach_from_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> detach_from_api::Builder { + detach_from_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state_by_api::Builder { + get_entity_state_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list_by_product::Builder { + list_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_by_product::Builder { + get_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn assign_to_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> assign_to_product::Builder { + assign_to_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn detach_from_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> detach_from_product::Builder { + detach_from_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state_by_product::Builder { + get_entity_state_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + 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, + scope: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_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(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_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(), + tag_id: tag_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + tag_id: tag_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_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(), + tag_id: tag_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state::Builder { + get_entity_state::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: 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/{}/apis/{}/operations/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2020-06-01-preview"); + 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::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 assign_to_operation { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TagContract = + 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::TagContract = + 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 detach_from_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_state_by_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2020-06-01-preview"); + 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::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 assign_to_api { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TagContract = + 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::TagContract = + 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 detach_from_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_state_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_by_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: 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/{}/products/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_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", "2020-06-01-preview"); + 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::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 assign_to_product { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TagContract = + 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::TagContract = + 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 detach_from_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_state_by_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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, + pub(crate) scope: 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 scope(mut self, scope: impl Into) -> Self { + self.scope = Some(scope.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/{}/tags", + 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", "2020-06-01-preview"); + 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()); + } + if let Some(scope) = &self.scope { + url.query_pairs_mut().append_pair("scope", scope); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_id: String, + pub(crate) parameters: models::TagCreateUpdateParameters, + 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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2020-06-01-preview"); + 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::TagContract = + 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::TagContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_id: String, + pub(crate) parameters: models::TagCreateUpdateParameters, + 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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2020-06-01-preview"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2020-06-01-preview"); + 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_state { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_product { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_apis( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_apis::Builder { + list_by_apis::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list_by_apis { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/products", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2020-06-01-preview"); + 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::ProductCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 api_policy { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + format: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_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, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_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, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_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/{}/apis/{}/policies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match 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)?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_id: String, + pub(crate) subscription_id: String, + pub(crate) format: Option, + } + impl Builder { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2020-06-01-preview"); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, + 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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2020-06-01-preview"); + 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::PolicyContract = + 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::PolicyContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2020-06-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_schema { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.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, + api_id: 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(), + api_id: api_id.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, + api_id: 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(), + api_id: api_id.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, + api_id: 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(), + api_id: api_id.into(), + schema_id: schema_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + force: None, + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + schema_id: schema_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/schemas", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2020-06-01-preview"); + 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::SchemaCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SchemaContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Accepted202, + Created201(models::SchemaContract), + Ok200(models::SchemaContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) schema_id: String, + pub(crate) parameters: models::SchemaContract, + 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2020-06-01-preview"); + 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::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SchemaContract = + 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::SchemaContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) schema_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + pub(crate) force: Option, + } + impl Builder { + pub fn force(mut self, force: bool) -> Self { + self.force = Some(force); + 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2020-06-01-preview"); + if let Some(force) = &self.force { + url.query_pairs_mut().append_pair("force", &force.to_string()); + } + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_diagnostic { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.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, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_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, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/diagnostics", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2020-06-01-preview"); + 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::DiagnosticCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::DiagnosticContract), + Ok200(models::DiagnosticContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + 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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2020-06-01-preview"); + 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::DiagnosticContract = + 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::DiagnosticContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + 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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2020-06-01-preview"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2020-06-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_issue { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + expand_comments_attachments: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + expand_comments_attachments: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + issue_id: issue_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_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, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) expand_comments_attachments: 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 expand_comments_attachments(mut self, expand_comments_attachments: bool) -> Self { + self.expand_comments_attachments = Some(expand_comments_attachments); + 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/{}/apis/{}/issues", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2020-06-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(expand_comments_attachments) = &self.expand_comments_attachments { + url.query_pairs_mut() + .append_pair("expandCommentsAttachments", &expand_comments_attachments.to_string()); + } + 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::IssueCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) subscription_id: String, + pub(crate) expand_comments_attachments: Option, + } + impl Builder { + pub fn expand_comments_attachments(mut self, expand_comments_attachments: bool) -> Self { + self.expand_comments_attachments = Some(expand_comments_attachments); + 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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2020-06-01-preview"); + if let Some(expand_comments_attachments) = &self.expand_comments_attachments { + url.query_pairs_mut() + .append_pair("expandCommentsAttachments", &expand_comments_attachments.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::IssueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueContract), + Ok200(models::IssueContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) parameters: models::IssueContract, + 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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2020-06-01-preview"); + 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::IssueContract = + 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::IssueContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) parameters: models::IssueUpdateContract, + 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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2020-06-01-preview"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2020-06-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_issue_comment { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: 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(), + api_id: api_id.into(), + issue_id: issue_id.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, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_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, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_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, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: 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/{}/apis/{}/issues/{}/comments", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2020-06-01-preview"); + 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::IssueCommentCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueCommentContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueCommentContract), + Ok200(models::IssueCommentContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_id: String, + pub(crate) parameters: models::IssueCommentContract, + 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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2020-06-01-preview"); + 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::IssueCommentContract = + 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::IssueCommentContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2020-06-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_issue_attachment { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: 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(), + api_id: api_id.into(), + issue_id: issue_id.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, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_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, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_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, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: 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/{}/apis/{}/issues/{}/attachments", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2020-06-01-preview"); + 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::IssueAttachmentCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueAttachmentContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueAttachmentContract), + Ok200(models::IssueAttachmentContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_id: String, + pub(crate) parameters: models::IssueAttachmentContract, + 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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2020-06-01-preview"); + 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::IssueAttachmentContract = + 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::IssueAttachmentContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2020-06-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_tag_description { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.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, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_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, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_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, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/tagDescriptions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2020-06-01-preview"); + 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::TagDescriptionCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagDescriptionContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::TagDescriptionContract), + Ok200(models::TagDescriptionContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_id: String, + pub(crate) parameters: models::TagDescriptionCreateParameters, + 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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2020-06-01-preview"); + 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::TagDescriptionContract = + 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::TagDescriptionContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2020-06-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 operation { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_tags( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_tags::Builder { + list_by_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + include_not_tagged_operations: None, + } + } + } + pub mod list_by_tags { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) include_not_tagged_operations: 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 include_not_tagged_operations(mut self, include_not_tagged_operations: bool) -> Self { + self.include_not_tagged_operations = Some(include_not_tagged_operations); + 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/{}/apis/{}/operationsByTags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2020-06-01-preview"); + 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()); + } + if let Some(include_not_tagged_operations) = &self.include_not_tagged_operations { + url.query_pairs_mut() + .append_pair("includeNotTaggedOperations", &include_not_tagged_operations.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::TagResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 api_version_set { + use super::models; + 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, + version_set_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(), + version_set_id: version_set_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_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(), + version_set_id: version_set_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + version_set_id: version_set_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_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(), + version_set_id: version_set_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, + version_set_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(), + version_set_id: version_set_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/apiVersionSets", + 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", "2020-06-01-preview"); + 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::ApiVersionSetCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiVersionSetContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::ApiVersionSetContract), + Ok200(models::ApiVersionSetContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_id: String, + pub(crate) parameters: models::ApiVersionSetContract, + 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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2020-06-01-preview"); + 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::ApiVersionSetContract = + 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::ApiVersionSetContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_id: String, + pub(crate) parameters: models::ApiVersionSetUpdateParameters, + 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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2020-06-01-preview"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiVersionSetContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2020-06-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 authorization_server { + use super::models; + 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, + authsid: 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(), + authsid: authsid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: 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(), + authsid: authsid.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + authsid: authsid.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: 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(), + authsid: authsid.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, + authsid: 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(), + authsid: authsid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + authsid: authsid.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/authorizationServers", + 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", "2020-06-01-preview"); + 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::AuthorizationServerCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationServerContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::AuthorizationServerContract), + Ok200(models::AuthorizationServerContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: String, + pub(crate) parameters: models::AuthorizationServerContract, + 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2020-06-01-preview"); + 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::AuthorizationServerContract = + 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::AuthorizationServerContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: String, + pub(crate) parameters: models::AuthorizationServerUpdateContract, + 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2020-06-01-preview"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationServerContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2020-06-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_secrets { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . authsid) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + 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::AuthorizationServerSecretsContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 backend { + use super::models; + 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, + backend_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(), + backend_id: backend_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_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(), + backend_id: backend_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + backend_id: backend_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_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(), + backend_id: backend_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, + backend_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(), + backend_id: backend_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn reconnect( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_id: impl Into, + subscription_id: impl Into, + ) -> reconnect::Builder { + reconnect::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + backend_id: backend_id.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/backends", + 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", "2020-06-01-preview"); + 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::BackendCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) backend_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/{}/backends/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.backend_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackendContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::BackendContract), + Ok200(models::BackendContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) backend_id: String, + pub(crate) parameters: models::BackendContract, + 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/{}/backends/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.backend_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", "2020-06-01-preview"); + 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::BackendContract = + 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::BackendContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) backend_id: String, + pub(crate) parameters: models::BackendUpdateParameters, + 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/{}/backends/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.backend_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", "2020-06-01-preview"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackendContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_service { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -3834,41 +12165,24 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) backend_id: String, + pub(crate) if_match: String, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, - pub(crate) is_key_vault_refresh_failed: 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 is_key_vault_refresh_failed(mut self, is_key_vault_refresh_failed: bool) -> Self { - self.is_key_vault_refresh_failed = Some(is_key_vault_refresh_failed); - self - } - 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.ApiManagement/service/{}/certificates", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.backend_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -3876,31 +12190,15 @@ pub mod certificate { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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()); - } - if let Some(is_key_vault_refresh_failed) = &self.is_key_vault_refresh_failed { - url.query_pairs_mut() - .append_pair("isKeyVaultRefreshFailed", &is_key_vault_refresh_failed.to_string()); - } + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CertificateCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -3915,7 +12213,7 @@ pub mod certificate { } } } - pub mod get { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3944,23 +12242,23 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, + pub(crate) backend_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.certificate_id + &self.backend_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -3974,12 +12272,7 @@ pub mod certificate { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CertificateContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -3994,13 +12287,8 @@ pub mod certificate { } } } - pub mod create_or_update { + pub mod reconnect { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::CertificateContract), - Ok200(models::CertificateContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -4028,29 +12316,28 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, - pub(crate) parameters: models::CertificateCreateOrUpdateParameters, + pub(crate) backend_id: String, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) parameters: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + 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> { + 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/{}/certificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}/reconnect", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.certificate_id + &self.backend_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4058,28 +12345,18 @@ pub mod certificate { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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); - } + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CertificateContract = - 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::CertificateContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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::ErrorResponse = @@ -4094,89 +12371,112 @@ pub mod certificate { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, +} +pub mod cache { + use super::models; + 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(), + top: None, + skip: None, + } } - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_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(), + cache_id: cache_id.into(), + subscription_id: subscription_id.into(), + } } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) certificate_id: String, - pub(crate) if_match: String, - pub(crate) subscription_id: String, + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_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(), + cache_id: cache_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + cache_id: cache_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_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(), + cache_id: cache_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } } - impl Builder { - 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/{}/certificates/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.certificate_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", "2020-06-01-preview"); - 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 fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_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(), + cache_id: cache_id.into(), + subscription_id: subscription_id.into(), } } } - pub mod get_entity_tag { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4205,23 +12505,31 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/certificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.certificate_id + &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::HEAD); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4229,13 +12537,24 @@ pub mod certificate { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + 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 => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CacheCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -4250,7 +12569,7 @@ pub mod certificate { } } } - pub mod refresh_secret { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4279,23 +12598,23 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, + pub(crate) cache_id: String, 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.ApiManagement/service/{}/certificates/{}/refreshSecret", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.certificate_id + &self.cache_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4304,7 +12623,6 @@ pub mod certificate { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); 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)?; @@ -4312,7 +12630,7 @@ pub mod certificate { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CertificateContract = + let rsp_value: models::CacheContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -4330,75 +12648,13 @@ pub mod certificate { } } } -} -pub mod content_type { - use super::models; - 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(), - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - content_type_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(), - content_type_id: content_type_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - content_type_id: 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(), - content_type_id: content_type_id.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - content_type_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(), - content_type_id: content_type_id.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::CacheContract), + Ok200(models::CacheContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -4426,21 +12682,29 @@ pub mod content_type { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) cache_id: String, + pub(crate) parameters: models::CacheContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/contentTypes", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.cache_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4448,17 +12712,27 @@ pub mod content_type { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::CacheContract = + 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::ContentTypeCollection = + let rsp_value: models::CacheContract = 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)?; @@ -4474,7 +12748,7 @@ pub mod content_type { } } } - pub mod get { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4503,23 +12777,25 @@ pub mod content_type { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, + pub(crate) cache_id: String, + pub(crate) parameters: models::CacheUpdateParameters, + pub(crate) if_match: String, 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.ApiManagement/service/{}/contentTypes/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.content_type_id + &self.cache_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4527,7 +12803,9 @@ pub mod content_type { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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)?; @@ -4535,7 +12813,7 @@ pub mod content_type { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ContentTypeContract = + let rsp_value: models::CacheContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -4553,12 +12831,12 @@ pub mod content_type { } } } - pub mod create_or_update { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::ContentTypeContract), - Ok200(models::ContentTypeContract), + Ok200, + NoContent204, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4587,28 +12865,24 @@ pub mod content_type { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, + pub(crate) cache_id: String, + pub(crate) if_match: String, 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/{}/contentTypes/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.content_type_id + &self.cache_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4616,27 +12890,15 @@ pub mod content_type { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - if let Some(if_match) = &self.if_match { - req_builder = req_builder.header("If-Match", if_match); - } + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ContentTypeContract = - 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::ContentTypeContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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 = @@ -4651,13 +12913,8 @@ pub mod content_type { } } } - pub mod delete { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -4685,24 +12942,23 @@ pub mod content_type { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) if_match: String, + pub(crate) cache_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.content_type_id + &self.cache_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4710,15 +12966,13 @@ pub mod content_type { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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), + 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 = @@ -4734,7 +12988,7 @@ pub mod content_type { } } } -pub mod content_item { +pub mod certificate { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -4742,31 +12996,31 @@ pub mod content_item { &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: 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(), - content_type_id: content_type_id.into(), subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + is_key_vault_refresh_failed: None, } } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: impl Into, - content_item_id: impl Into, + certificate_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(), - content_type_id: content_type_id.into(), - content_item_id: content_item_id.into(), + certificate_id: certificate_id.into(), subscription_id: subscription_id.into(), } } @@ -4774,16 +13028,16 @@ pub mod content_item { &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: impl Into, - content_item_id: impl Into, + certificate_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(), - content_type_id: content_type_id.into(), - content_item_id: content_item_id.into(), + certificate_id: certificate_id.into(), + parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, } @@ -4792,8 +13046,7 @@ pub mod content_item { &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: impl Into, - content_item_id: impl Into, + certificate_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -4801,8 +13054,7 @@ pub mod content_item { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - content_type_id: content_type_id.into(), - content_item_id: content_item_id.into(), + certificate_id: certificate_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -4811,16 +13063,29 @@ pub mod content_item { &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: impl Into, - content_item_id: impl Into, + certificate_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(), - content_type_id: content_type_id.into(), - content_item_id: content_item_id.into(), + certificate_id: certificate_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn refresh_secret( + &self, + resource_group_name: impl Into, + service_name: impl Into, + certificate_id: impl Into, + subscription_id: impl Into, + ) -> refresh_secret::Builder { + refresh_secret::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + certificate_id: certificate_id.into(), subscription_id: subscription_id.into(), } } @@ -4854,19 +13119,37 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) is_key_vault_refresh_failed: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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 is_key_vault_refresh_failed(mut self, is_key_vault_refresh_failed: bool) -> Self { + self.is_key_vault_refresh_failed = Some(is_key_vault_refresh_failed); + 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/{}/contentTypes/{}/contentItems", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.content_type_id + &self.service_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -4878,6 +13161,19 @@ pub mod content_item { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + 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()); + } + if let Some(is_key_vault_refresh_failed) = &self.is_key_vault_refresh_failed { + url.query_pairs_mut() + .append_pair("isKeyVaultRefreshFailed", &is_key_vault_refresh_failed.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)?; @@ -4886,7 +13182,7 @@ pub mod content_item { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ContentItemCollection = + let rsp_value: models::CertificateCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -4933,14 +13229,20 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) content_item_id: String, + pub(crate) certificate_id: String, 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.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_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); @@ -4959,7 +13261,7 @@ pub mod content_item { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ContentItemContract = + let rsp_value: models::CertificateContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -4981,8 +13283,8 @@ pub mod content_item { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::ContentItemContract), - Ok200(models::ContentItemContract), + Created201(models::CertificateContract), + Ok200(models::CertificateContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5011,8 +13313,8 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) content_item_id: String, + pub(crate) certificate_id: String, + pub(crate) parameters: models::CertificateCreateOrUpdateParameters, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -5023,7 +13325,14 @@ pub mod content_item { } 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/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_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); @@ -5034,10 +13343,11 @@ pub mod content_item { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -5045,13 +13355,13 @@ pub mod content_item { 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::ContentItemContract = + let rsp_value: models::CertificateContract = 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::ContentItemContract = + let rsp_value: models::CertificateContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -5103,15 +13413,21 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) content_item_id: String, + pub(crate) certificate_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/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_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); @@ -5129,8 +13445,82 @@ pub mod content_item { let rsp = 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::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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) certificate_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/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 = @@ -5145,7 +13535,7 @@ pub mod content_item { } } } - pub mod get_entity_tag { + pub mod refresh_secret { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5174,17 +13564,23 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) content_item_id: String, + pub(crate) certificate_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}/refreshSecret", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5193,12 +13589,18 @@ pub mod content_item { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CertificateContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -5214,44 +13616,73 @@ pub mod content_item { } } } -pub mod deleted_services { +pub mod content_type { use super::models; 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 { + 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(), } } - pub fn get_by_name( + pub fn get( &self, + resource_group_name: impl Into, service_name: impl Into, + content_type_id: impl Into, subscription_id: impl Into, - location: impl Into, - ) -> get_by_name::Builder { - get_by_name::Builder { + ) -> get::Builder { + get::Builder { client: self.0.clone(), + resource_group_name: resource_group_name.into(), service_name: service_name.into(), + content_type_id: content_type_id.into(), subscription_id: subscription_id.into(), - location: location.into(), } } - pub fn purge( + pub fn create_or_update( &self, + resource_group_name: impl Into, service_name: impl Into, + content_type_id: impl Into, subscription_id: impl Into, - location: impl Into, - ) -> purge::Builder { - purge::Builder { + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + content_type_id: content_type_id.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + content_type_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(), + content_type_id: content_type_id.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), - location: location.into(), } } } - pub mod list_by_subscription { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5278,15 +13709,19 @@ pub mod deleted_services { #[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, } 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.ApiManagement/deletedservices", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes", self.client.endpoint(), - &self.subscription_id + &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(); @@ -5306,7 +13741,7 @@ pub mod deleted_services { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DeletedServicesCollection = + let rsp_value: models::ContentTypeCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -5324,7 +13759,7 @@ pub mod deleted_services { } } } - pub mod get_by_name { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5351,19 +13786,21 @@ pub mod deleted_services { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) content_type_id: String, pub(crate) subscription_id: String, - pub(crate) location: 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.ApiManagement/locations/{}/deletedservices/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", self.client.endpoint(), &self.subscription_id, - &self.location, - &self.service_name + &self.resource_group_name, + &self.service_name, + &self.content_type_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -5383,7 +13820,7 @@ pub mod deleted_services { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DeletedServiceContract = + let rsp_value: models::ContentTypeContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -5401,13 +13838,12 @@ pub mod deleted_services { } } } - pub mod purge { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200, - Accepted202(models::DeletedServiceContract), - NoContent204, + Created201(models::ContentTypeContract), + Ok200(models::ContentTypeContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5434,23 +13870,30 @@ pub mod deleted_services { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) content_type_id: String, pub(crate) subscription_id: String, - pub(crate) location: 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/{}/providers/Microsoft.ApiManagement/locations/{}/deletedservices/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", self.client.endpoint(), &self.subscription_id, - &self.location, - &self.service_name + &self.resource_group_name, + &self.service_name, + &self.content_type_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5458,133 +13901,48 @@ pub mod deleted_services { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = 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::DeletedServiceContract = - 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, - }) - } + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); } - }) - } - } - } -} -pub mod api_management_operations { - use super::models; - 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; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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.ApiManagement/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", "2020-06-01-preview"); let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { + http::StatusCode::CREATED => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OperationListResult = + let rsp_value: models::ContentTypeContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + Ok(Response::Created201(rsp_value)) } - status_code => { + http::StatusCode::OK => { 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 api_management_service_skus { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Gets available SKUs for API Management service"] - pub fn list_available_service_skus( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> list_available_service_skus::Builder { - list_available_service_skus::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - subscription_id: subscription_id.into(), + let rsp_value: models::ContentTypeContract = + 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 list_available_service_skus { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -5612,21 +13970,24 @@ pub mod api_management_service_skus { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) content_type_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> { + 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/{}/skus", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.content_type_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5634,18 +13995,15 @@ pub mod api_management_service_skus { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ResourceSkuResults = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -5661,37 +14019,22 @@ pub mod api_management_service_skus { } } } -pub mod api_management_service { +pub mod content_item { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn restore( - &self, - resource_group_name: impl Into, - service_name: impl Into, - parameters: impl Into, - subscription_id: impl Into, - ) -> restore::Builder { - restore::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn backup( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + content_type_id: impl Into, subscription_id: impl Into, - ) -> backup::Builder { - backup::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - parameters: parameters.into(), + content_type_id: content_type_id.into(), subscription_id: subscription_id.into(), } } @@ -5699,12 +14042,16 @@ pub mod api_management_service { &self, resource_group_name: impl Into, service_name: impl Into, + content_type_id: impl Into, + content_item_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(), + content_type_id: content_type_id.into(), + content_item_id: content_item_id.into(), subscription_id: subscription_id.into(), } } @@ -5712,114 +14059,59 @@ pub mod api_management_service { &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + content_type_id: impl Into, + content_item_id: 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(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_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(), - service_name: service_name.into(), - parameters: parameters.into(), + content_type_id: content_type_id.into(), + content_item_id: content_item_id.into(), subscription_id: subscription_id.into(), + if_match: None, } } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, + content_type_id: impl Into, + content_item_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(), + content_type_id: content_type_id.into(), + content_item_id: content_item_id.into(), + if_match: if_match.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 fn get_sso_token( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> get_sso_token::Builder { - get_sso_token::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - subscription_id: subscription_id.into(), - } - } - 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 get_domain_ownership_identifier(&self, subscription_id: impl Into) -> get_domain_ownership_identifier::Builder { - get_domain_ownership_identifier::Builder { - client: self.0.clone(), - subscription_id: subscription_id.into(), - } - } - pub fn apply_network_configuration_updates( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, + content_type_id: impl Into, + content_item_id: impl Into, subscription_id: impl Into, - ) -> apply_network_configuration_updates::Builder { - apply_network_configuration_updates::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + content_type_id: content_type_id.into(), + content_item_id: content_item_id.into(), subscription_id: subscription_id.into(), - parameters: None, } } } - pub mod restore { + pub mod list_by_service { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -5847,22 +14139,23 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, + pub(crate) content_type_id: String, 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.ApiManagement/service/{}/restore", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.content_type_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5870,8 +14163,7 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -5879,11 +14171,83 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = + let rsp_value: models::ContentItemCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) content_type_id: String, + pub(crate) content_item_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/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContentItemContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(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 = @@ -5898,12 +14262,12 @@ pub mod api_management_service { } } } - pub mod backup { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, + Created201(models::ContentItemContract), + Ok200(models::ContentItemContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5932,22 +14296,22 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, + pub(crate) content_type_id: String, + pub(crate) content_item_id: String, 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/{}/backup", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5955,20 +14319,27 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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); + } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ContentItemContract = + 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::ApiManagementServiceResource = + let rsp_value: models::ContentItemContract = 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 = @@ -5983,8 +14354,13 @@ pub mod api_management_service { } } } - pub mod get { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6012,23 +14388,18 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) content_type_id: String, + pub(crate) content_item_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> { + 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/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6036,18 +14407,15 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -6062,14 +14430,8 @@ pub mod api_management_service { } } } - pub mod create_or_update { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ApiManagementServiceResource), - Created201(models::ApiManagementServiceResource), - Accepted202, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6097,22 +14459,17 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceResource, + pub(crate) content_type_id: String, + pub(crate) content_item_id: String, 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<(), Error>> { Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6120,26 +14477,13 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = - 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::ApiManagementServiceResource = - 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), + 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 = @@ -6154,13 +14498,46 @@ pub mod api_management_service { } } } - pub mod update { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, +} +pub mod deleted_services { + use super::models; + 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 get_by_name( + &self, + service_name: impl Into, + subscription_id: impl Into, + location: impl Into, + ) -> get_by_name::Builder { + get_by_name::Builder { + client: self.0.clone(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + location: location.into(), + } + } + pub fn purge( + &self, + service_name: impl Into, + subscription_id: impl Into, + location: impl Into, + ) -> purge::Builder { + purge::Builder { + client: self.0.clone(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + location: location.into(), + } } + } + pub mod list_by_subscription { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6186,24 +14563,19 @@ pub mod api_management_service { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceUpdateParameters, 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.ApiManagement/service/{}", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/deletedservices", self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name + &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::PATCH); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6211,8 +14583,7 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -6220,11 +14591,10 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = + let rsp_value: models::DeletedServicesCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(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 = @@ -6239,14 +14609,8 @@ pub mod api_management_service { } } } - pub mod delete { + pub mod get_by_name { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202(models::ApiManagementServiceResource), - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6272,23 +14636,23 @@ pub mod api_management_service { #[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) location: 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.ApiManagement/service/{}", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/locations/{}/deletedservices/{}", self.client.endpoint(), &self.subscription_id, - &self.resource_group_name, + &self.location, &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6302,14 +14666,12 @@ pub mod api_management_service { let rsp = 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 => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = + let rsp_value: models::DeletedServiceContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Accepted202(rsp_value)) + Ok(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 = @@ -6324,8 +14686,14 @@ pub mod api_management_service { } } } - pub mod list_by_resource_group { + pub mod purge { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::DeletedServiceContract), + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6351,23 +14719,23 @@ pub mod api_management_service { #[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) location: 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.ApiManagement/service", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/locations/{}/deletedservices/{}", self.client.endpoint(), &self.subscription_id, - &self.resource_group_name + &self.location, + &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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6381,12 +14749,14 @@ pub mod api_management_service { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { + 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::ApiManagementServiceListResult = + let rsp_value: models::DeletedServiceContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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 = @@ -6401,6 +14771,15 @@ pub mod api_management_service { } } } +} +pub mod api_management_operations { + use super::models; + 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; #[derive(Debug, thiserror :: Error)] @@ -6428,18 +14807,11 @@ pub mod api_management_service { #[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> { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.ApiManagement/service", - self.client.endpoint(), - &self.subscription_id - ); + let url_str = &format!("{}/providers/Microsoft.ApiManagement/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); @@ -6458,7 +14830,7 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceListResult = + let rsp_value: models::OperationListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -6476,7 +14848,27 @@ pub mod api_management_service { } } } - pub mod get_sso_token { +} +pub mod api_management_service_skus { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets available SKUs for API Management service"] + pub fn list_available_service_skus( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_available_service_skus::Builder { + list_available_service_skus::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_available_service_skus { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6508,13 +14900,10 @@ pub mod api_management_service { 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.ApiManagement/service/{}/getssotoken", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/skus", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -6522,7 +14911,7 @@ pub mod api_management_service { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6531,7 +14920,6 @@ pub mod api_management_service { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); 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)?; @@ -6539,7 +14927,7 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceGetSsoTokenResult = + let rsp_value: models::ResourceSkuResults = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -6557,8 +14945,166 @@ pub mod api_management_service { } } } - pub mod check_name_availability { +} +pub mod api_management_service { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn restore( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> restore::Builder { + restore::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn backup( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> backup::Builder { + backup::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: 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(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + 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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: 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(), + 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 fn get_sso_token( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> get_sso_token::Builder { + get_sso_token::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + 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 get_domain_ownership_identifier(&self, subscription_id: impl Into) -> get_domain_ownership_identifier::Builder { + get_domain_ownership_identifier::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn apply_network_configuration_updates( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> apply_network_configuration_updates::Builder { + apply_network_configuration_updates::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + } + pub mod restore { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6584,19 +15130,20 @@ pub mod api_management_service { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) parameters: models::ApiManagementServiceCheckNameAvailabilityParameters, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, 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.ApiManagement/checkNameAvailability", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/restore", self.client.endpoint(), - &self.subscription_id + &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(); @@ -6617,10 +15164,11 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceNameAvailabilityResult = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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 = @@ -6635,8 +15183,13 @@ pub mod api_management_service { } } } - pub mod get_domain_ownership_identifier { + pub mod backup { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6662,20 +15215,20 @@ pub mod api_management_service { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, 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.ApiManagement/getDomainOwnershipIdentifier", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backup", self.client.endpoint(), - &self.subscription_id + &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(); @@ -6687,8 +15240,8 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + 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)?; @@ -6696,10 +15249,11 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceGetDomainOwnershipIdentifierResult = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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 = @@ -6711,16 +15265,11 @@ pub mod api_management_service { } } }) - } - } - } - pub mod apply_network_configuration_updates { - use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Ok200(models::ApiManagementServiceResource), + } } + } + pub mod get { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6749,19 +15298,22 @@ pub mod api_management_service { pub(crate) resource_group_name: String, pub(crate) 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> { + 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/{}/applynetworkconfigurationupdates" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", + 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6769,23 +15321,17 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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 - }; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -6801,114 +15347,14 @@ pub mod api_management_service { } } } -} -pub mod diagnostic { - use super::models; - 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, - diagnostic_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(), - diagnostic_id: diagnostic_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - diagnostic_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(), - diagnostic_id: diagnostic_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - diagnostic_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - diagnostic_id: diagnostic_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - diagnostic_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(), - diagnostic_id: diagnostic_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, - diagnostic_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(), - diagnostic_id: diagnostic_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Created201(models::ApiManagementServiceResource), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6936,28 +15382,14 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) parameters: models::ApiManagementServiceResource, 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> { + 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/{}/diagnostics", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -6965,7 +15397,7 @@ pub mod diagnostic { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6973,16 +15405,8 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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.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)?; @@ -6990,10 +15414,17 @@ pub mod diagnostic { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DiagnosticCollection = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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::ApiManagementServiceResource = + 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 = @@ -7008,8 +15439,13 @@ pub mod diagnostic { } } } - pub mod get { + pub mod update { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7037,23 +15473,22 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, + pub(crate) parameters: models::ApiManagementServiceUpdateParameters, 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.ApiManagement/service/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7061,7 +15496,8 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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)?; @@ -7069,10 +15505,11 @@ pub mod diagnostic { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DiagnosticContract = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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 = @@ -7087,12 +15524,13 @@ pub mod diagnostic { } } } - pub mod create_or_update { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::DiagnosticContract), - Ok200(models::DiagnosticContract), + Ok200, + Accepted202(models::ApiManagementServiceResource), + NoContent204, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7121,29 +15559,21 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, - pub(crate) parameters: models::DiagnosticContract, 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/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7151,28 +15581,20 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let 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::DiagnosticContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Created201(rsp_value)) - } - http::StatusCode::OK => { + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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::DiagnosticContract = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + 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 = @@ -7187,7 +15609,7 @@ pub mod diagnostic { } } } - pub mod update { + pub mod list_by_resource_group { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7215,26 +15637,22 @@ pub mod diagnostic { pub struct Builder { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) diagnostic_id: String, - pub(crate) parameters: models::DiagnosticContract, - pub(crate) if_match: String, 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.ApiManagement/service/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service", self.client.endpoint(), &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.diagnostic_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::PATCH); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7242,9 +15660,7 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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.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)?; @@ -7252,7 +15668,7 @@ pub mod diagnostic { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DiagnosticContract = + let rsp_value: models::ApiManagementServiceListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -7270,13 +15686,8 @@ pub mod diagnostic { } } } - pub mod delete { + pub mod list { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7302,26 +15713,21 @@ pub mod diagnostic { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) diagnostic_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> { + 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/{}/diagnostics/{}", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/service", self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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::DELETE); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7329,15 +15735,18 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -7352,7 +15761,7 @@ pub mod diagnostic { } } } - pub mod get_entity_tag { + pub mod get_sso_token { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7381,23 +15790,24 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/getssotoken", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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::HEAD); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7406,12 +15816,18 @@ pub mod diagnostic { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceGetSsoTokenResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -7426,113 +15842,7 @@ pub mod diagnostic { } } } -} -pub mod email_template { - use super::models; - 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, - template_name: 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(), - template_name: template_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - template_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(), - service_name: service_name.into(), - template_name: template_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - template_name: impl Into, - if_match: impl Into, - parameters: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - template_name: template_name.into(), - if_match: if_match.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - template_name: 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(), - template_name: template_name.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, - template_name: 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(), - template_name: template_name.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod check_name_availability { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7559,38 +15869,23 @@ pub mod email_template { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, + pub(crate) parameters: models::ApiManagementServiceCheckNameAvailabilityParameters, 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> { + 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/{}/templates", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/checkNameAvailability", self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name + &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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7598,16 +15893,8 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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.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)?; @@ -7615,7 +15902,7 @@ pub mod email_template { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateCollection = + let rsp_value: models::ApiManagementServiceNameAvailabilityResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -7633,7 +15920,7 @@ pub mod email_template { } } } - pub mod get { + pub mod get_domain_ownership_identifier { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7660,25 +15947,24 @@ pub mod email_template { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) template_name: String, 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.ApiManagement/service/{}/templates/{}", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier", self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.template_name + &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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7687,6 +15973,7 @@ pub mod email_template { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); 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)?; @@ -7694,7 +15981,7 @@ pub mod email_template { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateContract = + let rsp_value: models::ApiManagementServiceGetDomainOwnershipIdentifierResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -7712,12 +15999,12 @@ pub mod email_template { } } } - pub mod create_or_update { + pub mod apply_network_configuration_updates { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::EmailTemplateContract), - Ok200(models::EmailTemplateContract), + Accepted202, + Ok200(models::ApiManagementServiceResource), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7746,29 +16033,20 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, - pub(crate) parameters: models::EmailTemplateUpdateParameters, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) parameters: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + 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.ApiManagement/service/{}/templates/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.template_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/applynetworkconfigurationupdates" , 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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7776,25 +16054,21 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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); - } + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateContract = - 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), http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateContract = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -7812,7 +16086,113 @@ pub mod email_template { } } } - pub mod update { +} +pub mod diagnostic { + use super::models; + 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, + diagnostic_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(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + diagnostic_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(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + diagnostic_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + diagnostic_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(), + diagnostic_id: diagnostic_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, + diagnostic_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(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7841,25 +16221,36 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, - pub(crate) if_match: String, - pub(crate) parameters: models::EmailTemplateUpdateParameters, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/templates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.template_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7867,9 +16258,16 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - req_builder = req_builder.header("If-Match", &self.if_match); - 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(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)?; @@ -7877,7 +16275,7 @@ pub mod email_template { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateContract = + let rsp_value: models::DiagnosticCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -7895,13 +16293,8 @@ pub mod email_template { } } } - pub mod delete { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7929,24 +16322,23 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, - pub(crate) if_match: String, + pub(crate) diagnostic_id: String, 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.ApiManagement/service/{}/templates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.template_name + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7954,15 +16346,18 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -7977,8 +16372,13 @@ pub mod email_template { } } } - pub mod get_entity_tag { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::DiagnosticContract), + Ok200(models::DiagnosticContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8006,23 +16406,29 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/templates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.template_name + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8030,13 +16436,28 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(()), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + 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::DiagnosticContract = + 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 = @@ -8051,162 +16472,7 @@ pub mod email_template { } } } -} -pub mod gateway { - use super::models; - 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, - gateway_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(), - gateway_id: gateway_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_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(), - gateway_id: gateway_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - gateway_id: gateway_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_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(), - gateway_id: gateway_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, - gateway_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(), - gateway_id: gateway_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_keys( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - subscription_id: impl Into, - ) -> list_keys::Builder { - list_keys::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - gateway_id: gateway_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn regenerate_key( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: 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(), - service_name: service_name.into(), - gateway_id: gateway_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn generate_token( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - parameters: impl Into, - subscription_id: impl Into, - ) -> generate_token::Builder { - generate_token::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - gateway_id: gateway_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8235,36 +16501,25 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + pub(crate) if_match: 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> { + 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/{}/gateways", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8272,16 +16527,9 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.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)?; @@ -8289,7 +16537,7 @@ pub mod gateway { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayCollection = + let rsp_value: models::DiagnosticContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -8307,8 +16555,13 @@ pub mod gateway { } } } - pub mod get { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8336,23 +16589,24 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, + pub(crate) diagnostic_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> { + 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/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8360,18 +16614,15 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -8386,13 +16637,8 @@ pub mod gateway { } } } - pub mod create_or_update { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::GatewayContract), - Ok200(models::GatewayContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8420,29 +16666,23 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) parameters: models::GatewayContract, + pub(crate) diagnostic_id: String, 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> { + 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/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8450,28 +16690,13 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::GatewayContract = - 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::GatewayContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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 = @@ -8486,7 +16711,113 @@ pub mod gateway { } } } - pub mod update { +} +pub mod email_template { + use super::models; + 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, + template_name: 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(), + template_name: template_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + template_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(), + service_name: service_name.into(), + template_name: template_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + template_name: impl Into, + if_match: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + template_name: template_name.into(), + if_match: if_match.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + template_name: 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(), + template_name: template_name.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, + template_name: 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(), + template_name: template_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8515,25 +16846,36 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) parameters: models::GatewayContract, - pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.gateway_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8541,9 +16883,16 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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.header("If-Match", &self.if_match); + 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)?; @@ -8551,7 +16900,7 @@ pub mod gateway { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayContract = + let rsp_value: models::EmailTemplateCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -8569,13 +16918,8 @@ pub mod gateway { } } } - pub mod delete { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8603,24 +16947,23 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) if_match: String, + pub(crate) template_name: String, 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.ApiManagement/service/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8628,15 +16971,18 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EmailTemplateContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -8651,8 +16997,13 @@ pub mod gateway { } } } - pub mod get_entity_tag { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::EmailTemplateContract), + Ok200(models::EmailTemplateContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8680,23 +17031,29 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, + pub(crate) template_name: String, + pub(crate) parameters: models::EmailTemplateUpdateParameters, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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::HEAD); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8704,13 +17061,28 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(()), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EmailTemplateContract = + 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::EmailTemplateContract = + 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 = @@ -8725,7 +17097,7 @@ pub mod gateway { } } } - pub mod list_keys { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8754,23 +17126,25 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, + pub(crate) template_name: String, + pub(crate) if_match: String, + pub(crate) parameters: models::EmailTemplateUpdateParameters, 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.ApiManagement/service/{}/gateways/{}/listKeys", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8778,8 +17152,9 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.header("If-Match", &self.if_match); + 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)?; @@ -8787,7 +17162,7 @@ pub mod gateway { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayKeysContract = + let rsp_value: models::EmailTemplateContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -8805,8 +17180,13 @@ pub mod gateway { } } } - pub mod regenerate_key { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8834,24 +17214,24 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) parameters: models::GatewayKeyRegenerationRequestContract, + pub(crate) template_name: 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<(), Error>> { + 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/{}/gateways/{}/regenerateKey", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8859,14 +17239,15 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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.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::NO_CONTENT => Ok(()), + 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 = @@ -8881,7 +17262,7 @@ pub mod gateway { } } } - pub mod generate_token { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8910,24 +17291,23 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) parameters: models::GatewayTokenRequestContract, + pub(crate) template_name: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/generateToken", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8935,19 +17315,13 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayTokenContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -8963,7 +17337,7 @@ pub mod gateway { } } } -pub mod gateway_hostname_configuration { +pub mod gateway { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -8971,14 +17345,12 @@ pub mod gateway_hostname_configuration { &self, resource_group_name: impl Into, service_name: impl Into, - gateway_id: 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(), - gateway_id: gateway_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, @@ -8990,7 +17362,6 @@ pub mod gateway_hostname_configuration { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - hc_id: impl Into, subscription_id: impl Into, ) -> get::Builder { get::Builder { @@ -8998,7 +17369,6 @@ pub mod gateway_hostname_configuration { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - hc_id: hc_id.into(), subscription_id: subscription_id.into(), } } @@ -9007,8 +17377,7 @@ pub mod gateway_hostname_configuration { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - hc_id: impl Into, - parameters: impl Into, + parameters: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -9016,18 +17385,35 @@ pub mod gateway_hostname_configuration { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - hc_id: hc_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, } } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - hc_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -9036,7 +17422,6 @@ pub mod gateway_hostname_configuration { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - hc_id: hc_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -9046,7 +17431,6 @@ pub mod gateway_hostname_configuration { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - hc_id: impl Into, subscription_id: impl Into, ) -> get_entity_tag::Builder { get_entity_tag::Builder { @@ -9054,7 +17438,55 @@ pub mod gateway_hostname_configuration { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - hc_id: hc_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_keys( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + subscription_id: impl Into, + ) -> list_keys::Builder { + list_keys::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn regenerate_key( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: 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(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn generate_token( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> generate_token::Builder { + generate_token::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + parameters: parameters.into(), subscription_id: subscription_id.into(), } } @@ -9088,7 +17520,6 @@ pub mod gateway_hostname_configuration { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, @@ -9107,12 +17538,15 @@ pub mod gateway_hostname_configuration { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/gateways/{}/hostnameConfigurations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/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); @@ -9140,7 +17574,7 @@ pub mod gateway_hostname_configuration { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayHostnameConfigurationCollection = + let rsp_value: models::GatewayCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -9188,15 +17622,19 @@ pub mod gateway_hostname_configuration { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) hc_id: String, 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.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_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); @@ -9215,7 +17653,7 @@ pub mod gateway_hostname_configuration { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayHostnameConfigurationContract = + let rsp_value: models::GatewayContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -9237,8 +17675,8 @@ pub mod gateway_hostname_configuration { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::GatewayHostnameConfigurationContract), - Ok200(models::GatewayHostnameConfigurationContract), + Created201(models::GatewayContract), + Ok200(models::GatewayContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9268,8 +17706,7 @@ pub mod gateway_hostname_configuration { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) hc_id: String, - pub(crate) parameters: models::GatewayHostnameConfigurationContract, + pub(crate) parameters: models::GatewayContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -9280,7 +17717,14 @@ pub mod gateway_hostname_configuration { } 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/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_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); @@ -9291,11 +17735,11 @@ pub mod gateway_hostname_configuration { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + 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.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)?; @@ -9303,13 +17747,13 @@ pub mod gateway_hostname_configuration { 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::GatewayHostnameConfigurationContract = + let rsp_value: models::GatewayContract = 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::GatewayHostnameConfigurationContract = + let rsp_value: models::GatewayContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -9327,13 +17771,8 @@ pub mod gateway_hostname_configuration { } } } - pub mod delete { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9362,17 +17801,24 @@ pub mod gateway_hostname_configuration { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) hc_id: String, + pub(crate) parameters: models::GatewayContract, pub(crate) if_match: String, 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.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9380,15 +17826,20 @@ pub mod gateway_hostname_configuration { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + 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.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), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -9403,8 +17854,13 @@ pub mod gateway_hostname_configuration { } } } - pub mod get_entity_tag { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9433,16 +17889,23 @@ pub mod gateway_hostname_configuration { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) hc_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<(), Error>> { + 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/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9450,13 +17913,15 @@ pub mod gateway_hostname_configuration { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + 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(()), + 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 = @@ -9471,83 +17936,7 @@ pub mod gateway_hostname_configuration { } } } -} -pub mod gateway_api { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_service( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: 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(), - gateway_id: gateway_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - api_id: 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(), - gateway_id: gateway_id.into(), - api_id: api_id.into(), - subscription_id: subscription_id.into(), - parameters: None, - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - api_id: 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(), - gateway_id: gateway_id.into(), - api_id: api_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn get_entity_tag( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - api_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(), - gateway_id: gateway_id.into(), - api_id: api_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9578,27 +17967,12 @@ pub mod gateway_api { pub(crate) service_name: String, pub(crate) gateway_id: 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> { + 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/{}/gateways/{}/apis", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -9607,7 +17981,7 @@ pub mod gateway_api { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9615,27 +17989,13 @@ pub mod gateway_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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::ApiCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -9650,13 +18010,8 @@ pub mod gateway_api { } } } - pub mod create_or_update { + pub mod list_keys { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ApiContract), - Ok200(models::ApiContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9685,29 +18040,22 @@ pub mod gateway_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) api_id: 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> { + 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/{}/gateways/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/listKeys", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id, - &self.api_id + &self.gateway_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9715,28 +18063,18 @@ pub mod gateway_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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 - }; + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiContract = - 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::ApiContract = + let rsp_value: models::GatewayKeysContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -9752,13 +18090,8 @@ pub mod gateway_api { } } } - pub mod delete { + pub mod regenerate_key { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9787,24 +18120,23 @@ pub mod gateway_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) api_id: String, + pub(crate) parameters: models::GatewayKeyRegenerationRequestContract, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/regenerateKey", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id, - &self.api_id + &self.gateway_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9812,14 +18144,14 @@ pub mod gateway_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::NO_CONTENT => Ok(Response::NoContent204), + 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::ErrorResponse = @@ -9834,7 +18166,7 @@ pub mod gateway_api { } } } - pub mod get_entity_tag { + pub mod generate_token { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9864,24 +18196,23 @@ pub mod gateway_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) api_id: String, + pub(crate) parameters: models::GatewayTokenRequestContract, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/gateways/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/generateToken", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id, - &self.api_id + &self.gateway_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9889,13 +18220,19 @@ pub mod gateway_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayTokenContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -9911,7 +18248,7 @@ pub mod gateway_api { } } } -pub mod gateway_certificate_authority { +pub mod gateway_hostname_configuration { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -9938,7 +18275,7 @@ pub mod gateway_certificate_authority { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - certificate_id: impl Into, + hc_id: impl Into, subscription_id: impl Into, ) -> get::Builder { get::Builder { @@ -9946,7 +18283,7 @@ pub mod gateway_certificate_authority { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - certificate_id: certificate_id.into(), + hc_id: hc_id.into(), subscription_id: subscription_id.into(), } } @@ -9955,8 +18292,8 @@ pub mod gateway_certificate_authority { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - certificate_id: impl Into, - parameters: impl Into, + hc_id: impl Into, + parameters: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -9964,7 +18301,7 @@ pub mod gateway_certificate_authority { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - certificate_id: certificate_id.into(), + hc_id: hc_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -9975,7 +18312,7 @@ pub mod gateway_certificate_authority { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - certificate_id: impl Into, + hc_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -9984,7 +18321,7 @@ pub mod gateway_certificate_authority { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - certificate_id: certificate_id.into(), + hc_id: hc_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -9994,7 +18331,7 @@ pub mod gateway_certificate_authority { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - certificate_id: impl Into, + hc_id: impl Into, subscription_id: impl Into, ) -> get_entity_tag::Builder { get_entity_tag::Builder { @@ -10002,7 +18339,7 @@ pub mod gateway_certificate_authority { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - certificate_id: certificate_id.into(), + hc_id: hc_id.into(), subscription_id: subscription_id.into(), } } @@ -10057,10 +18394,10 @@ pub mod gateway_certificate_authority { } pub fn into_future( self, - ) -> futures::future::BoxFuture<'static, std::result::Result> + ) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_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); @@ -10088,7 +18425,7 @@ pub mod gateway_certificate_authority { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayCertificateAuthorityCollection = + let rsp_value: models::GatewayHostnameConfigurationCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -10136,15 +18473,15 @@ pub mod gateway_certificate_authority { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) certificate_id: String, + pub(crate) hc_id: String, pub(crate) subscription_id: String, } impl Builder { pub fn into_future( self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + ) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_id) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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); @@ -10163,7 +18500,7 @@ pub mod gateway_certificate_authority { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayCertificateAuthorityContract = + let rsp_value: models::GatewayHostnameConfigurationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -10185,8 +18522,8 @@ pub mod gateway_certificate_authority { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::GatewayCertificateAuthorityContract), - Ok200(models::GatewayCertificateAuthorityContract), + Created201(models::GatewayHostnameConfigurationContract), + Ok200(models::GatewayHostnameConfigurationContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -10216,8 +18553,8 @@ pub mod gateway_certificate_authority { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) certificate_id: String, - pub(crate) parameters: models::GatewayCertificateAuthorityContract, + pub(crate) hc_id: String, + pub(crate) parameters: models::GatewayHostnameConfigurationContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -10228,7 +18565,7 @@ pub mod gateway_certificate_authority { } 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/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_id) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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); @@ -10251,13 +18588,13 @@ pub mod gateway_certificate_authority { 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::GatewayCertificateAuthorityContract = + let rsp_value: models::GatewayHostnameConfigurationContract = 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::GatewayCertificateAuthorityContract = + let rsp_value: models::GatewayHostnameConfigurationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -10310,14 +18647,14 @@ pub mod gateway_certificate_authority { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) certificate_id: String, + pub(crate) hc_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/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_id) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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); @@ -10381,13 +18718,13 @@ pub mod gateway_certificate_authority { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) certificate_id: String, + pub(crate) hc_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/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_id) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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); @@ -10420,7 +18757,7 @@ pub mod gateway_certificate_authority { } } } -pub mod group { +pub mod gateway_api { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -10428,84 +18765,52 @@ pub mod group { &self, resource_group_name: impl Into, service_name: impl Into, + gateway_id: 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(), + gateway_id: gateway_id.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, - group_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(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), - } - } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - parameters: impl Into, + gateway_id: impl Into, + api_id: 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(), - group_id: group_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - group_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - group_id: group_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), + gateway_id: gateway_id.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), + parameters: None, } } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - if_match: impl Into, + gateway_id: impl Into, + api_id: 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(), - group_id: group_id.into(), - if_match: if_match.into(), + gateway_id: gateway_id.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), } } @@ -10513,14 +18818,16 @@ pub mod group { &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, + gateway_id: impl Into, + api_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(), - group_id: group_id.into(), + gateway_id: gateway_id.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), } } @@ -10554,6 +18861,7 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) gateway_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, @@ -10572,14 +18880,15 @@ pub mod group { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/groups", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.gateway_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -10595,201 +18904,22 @@ pub mod group { 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::GroupCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) group_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/{}/groups/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.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", "2020-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GroupContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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; - #[derive(Debug)] - pub enum Response { - Created201(models::GroupContract), - Ok200(models::GroupContract), - } - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) group_id: String, - pub(crate) parameters: models::GroupCreateParameters, - 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/{}/groups/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.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::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", "2020-06-01-preview"); - 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); + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GroupContract = - 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::GroupContract = + let rsp_value: models::ApiCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -10805,8 +18935,13 @@ pub mod group { } } } - pub mod update { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ApiContract), + Ok200(models::ApiContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -10834,25 +18969,30 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) parameters: models::GroupUpdateParameters, - pub(crate) if_match: String, + pub(crate) gateway_id: String, + pub(crate) api_id: String, pub(crate) subscription_id: String, + pub(crate) parameters: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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.ApiManagement/service/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.gateway_id, + &self.api_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -10860,19 +19000,28 @@ pub mod group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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.header("If-Match", &self.if_match); + 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::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiContract = + 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::GroupContract = + let rsp_value: models::ApiContract = 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)?; @@ -10922,20 +19071,21 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) if_match: String, + pub(crate) gateway_id: String, + pub(crate) api_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/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.gateway_id, + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -10947,7 +19097,6 @@ pub mod group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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)?; @@ -10999,19 +19148,21 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, + pub(crate) gateway_id: String, + pub(crate) api_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/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.gateway_id, + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -11045,81 +19196,103 @@ pub mod group { } } } -pub mod group_user { +pub mod gateway_certificate_authority { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, + gateway_id: impl Into, subscription_id: impl Into, - ) -> list::Builder { - list::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - group_id: group_id.into(), + gateway_id: gateway_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, } } - pub fn create( + pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - user_id: impl Into, + gateway_id: impl Into, + certificate_id: impl Into, subscription_id: impl Into, - ) -> create::Builder { - create::Builder { + ) -> get::Builder { + get::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - group_id: group_id.into(), - user_id: user_id.into(), + gateway_id: gateway_id.into(), + certificate_id: certificate_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + certificate_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(), + gateway_id: gateway_id.into(), + certificate_id: certificate_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, - group_id: impl Into, - user_id: impl Into, + gateway_id: impl Into, + certificate_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(), - group_id: group_id.into(), - user_id: user_id.into(), + gateway_id: gateway_id.into(), + certificate_id: certificate_id.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } - pub fn check_entity_exists( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - user_id: impl Into, + gateway_id: impl Into, + certificate_id: impl Into, subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - group_id: group_id.into(), - user_id: user_id.into(), + gateway_id: gateway_id.into(), + certificate_id: certificate_id.into(), subscription_id: subscription_id.into(), } } } - pub mod list { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11148,7 +19321,7 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, + pub(crate) gateway_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, @@ -11167,16 +19340,12 @@ pub mod group_user { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/groups/{}/users", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_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); @@ -11204,7 +19373,7 @@ pub mod group_user { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::UserCollection = + let rsp_value: models::GatewayCertificateAuthorityCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -11222,12 +19391,87 @@ pub mod group_user { } } } - pub mod create { + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) gateway_id: String, + pub(crate) certificate_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/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayCertificateAuthorityContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; #[derive(Debug)] pub enum Response { - Created201(models::UserContract), - Ok200(models::UserContract), + Created201(models::GatewayCertificateAuthorityContract), + Ok200(models::GatewayCertificateAuthorityContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11256,22 +19500,20 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) user_id: String, + pub(crate) gateway_id: String, + pub(crate) certificate_id: String, + pub(crate) parameters: models::GatewayCertificateAuthorityContract, 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/{}/groups/{}/users/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id, - &self.user_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_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); @@ -11282,7 +19524,11 @@ pub mod group_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + 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)?; @@ -11290,13 +19536,13 @@ pub mod group_user { 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::UserContract = + let rsp_value: models::GatewayCertificateAuthorityContract = 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::UserContract = + let rsp_value: models::GatewayCertificateAuthorityContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -11348,22 +19594,15 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) user_id: String, + pub(crate) gateway_id: String, + pub(crate) certificate_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/{}/groups/{}/users/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id, - &self.user_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_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); @@ -11374,6 +19613,7 @@ pub mod group_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + 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)?; @@ -11396,12 +19636,10 @@ pub mod group_user { } } } - pub mod check_entity_exists { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Error response #response_type")] - NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -11427,22 +19665,14 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) user_id: String, + pub(crate) gateway_id: String, + pub(crate) certificate_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/{}/groups/{}/users/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id, - &self.user_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_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); @@ -11459,8 +19689,7 @@ pub mod group_user { let 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(()), - http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + 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 = @@ -11476,7 +19705,7 @@ pub mod group_user { } } } -pub mod identity_provider { +pub mod group { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -11491,20 +19720,23 @@ pub mod identity_provider { 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, - identity_provider_name: impl Into, + group_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(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -11512,15 +19744,15 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, - parameters: impl Into, + group_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(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -11530,8 +19762,8 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, - parameters: impl Into, + group_id: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -11539,7 +19771,7 @@ pub mod identity_provider { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), @@ -11549,7 +19781,7 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, + group_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -11557,7 +19789,7 @@ pub mod identity_provider { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -11566,29 +19798,14 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, + group_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(), - identity_provider_name: identity_provider_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_secrets( - &self, - resource_group_name: impl Into, - service_name: impl Into, - identity_provider_name: impl Into, - subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -11623,12 +19840,27 @@ pub mod identity_provider { 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 into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/identityProviders", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -11644,6 +19876,15 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + 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)?; @@ -11652,7 +19893,7 @@ pub mod identity_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IdentityProviderList = + let rsp_value: models::GroupCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -11699,19 +19940,19 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, + pub(crate) group_id: String, 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.ApiManagement/service/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -11731,7 +19972,7 @@ pub mod identity_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IdentityProviderContract = + let rsp_value: models::GroupContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -11753,8 +19994,8 @@ pub mod identity_provider { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::IdentityProviderContract), - Ok200(models::IdentityProviderContract), + Created201(models::GroupContract), + Ok200(models::GroupContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11783,8 +20024,8 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, - pub(crate) parameters: models::IdentityProviderCreateContract, + pub(crate) group_id: String, + pub(crate) parameters: models::GroupCreateParameters, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -11796,12 +20037,12 @@ pub mod identity_provider { 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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -11825,13 +20066,13 @@ pub mod identity_provider { 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::IdentityProviderContract = + let rsp_value: models::GroupContract = 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::IdentityProviderContract = + let rsp_value: models::GroupContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -11878,21 +20119,21 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, - pub(crate) parameters: models::IdentityProviderUpdateParameters, + pub(crate) group_id: String, + pub(crate) parameters: models::GroupUpdateParameters, pub(crate) if_match: String, 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.ApiManagement/service/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -11904,20 +20145,102 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GroupContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) group_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/{}/groups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.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::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", "2020-06-01-preview"); 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IdentityProviderContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -11932,13 +20255,8 @@ pub mod identity_provider { } } } - pub mod delete { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -11966,24 +20284,23 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, - pub(crate) if_match: String, + pub(crate) group_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.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::DELETE); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11991,15 +20308,13 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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), + 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 = @@ -12014,7 +20329,82 @@ pub mod identity_provider { } } } - pub mod get_entity_tag { +} +pub mod group_user { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn create( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + user_id: 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(), + group_id: group_id.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12043,23 +20433,38 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, + pub(crate) group_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.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::HEAD); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12067,13 +20472,27 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + 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 => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UserCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -12088,8 +20507,13 @@ pub mod identity_provider { } } } - pub mod list_secrets { + pub mod create { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::UserContract), + Ok200(models::UserContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12117,16 +20541,25 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, + pub(crate) group_id: String, + pub(crate) user_id: String, 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.ApiManagement/service/{}/identityProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . identity_provider_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.group_id, + &self.user_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12135,17 +20568,22 @@ pub mod identity_provider { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); 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::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UserContract = + 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::ClientSecretContract = + let rsp_value: models::UserContract = 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)?; @@ -12161,45 +20599,13 @@ pub mod identity_provider { } } } -} -pub mod issue { - use super::models; - 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, - issue_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(), - issue_id: issue_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12221,42 +20627,31 @@ pub mod issue { ResponseBytes(#[source] azure_core::error::Error), #[error("Failed to deserialize response, body: {1:?}")] Deserialize(#[source] 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> { + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) group_id: String, + pub(crate) user_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/{}/issues", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.group_id, + &self.user_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12264,27 +20659,14 @@ pub mod issue { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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::IssueCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -12299,10 +20681,12 @@ pub mod issue { } } } - pub mod get { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -12328,23 +20712,25 @@ pub mod issue { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) issue_id: String, + pub(crate) group_id: String, + pub(crate) user_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/issues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.issue_id + &self.group_id, + &self.user_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12358,12 +20744,8 @@ pub mod issue { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IssueContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + http::StatusCode::NO_CONTENT => Ok(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -12379,7 +20761,7 @@ pub mod issue { } } } -pub mod logger { +pub mod identity_provider { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -12394,23 +20776,20 @@ pub mod logger { 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, - logger_id: impl Into, + identity_provider_name: 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(), - logger_id: logger_id.into(), + identity_provider_name: identity_provider_name.into(), subscription_id: subscription_id.into(), } } @@ -12418,15 +20797,15 @@ pub mod logger { &self, resource_group_name: impl Into, service_name: impl Into, - logger_id: impl Into, - parameters: impl Into, + identity_provider_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(), service_name: service_name.into(), - logger_id: logger_id.into(), + identity_provider_name: identity_provider_name.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -12436,8 +20815,8 @@ pub mod logger { &self, resource_group_name: impl Into, service_name: impl Into, - logger_id: impl Into, - parameters: impl Into, + identity_provider_name: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -12445,7 +20824,7 @@ pub mod logger { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - logger_id: logger_id.into(), + identity_provider_name: identity_provider_name.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), @@ -12455,7 +20834,7 @@ pub mod logger { &self, resource_group_name: impl Into, service_name: impl Into, - logger_id: impl Into, + identity_provider_name: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -12463,7 +20842,7 @@ pub mod logger { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - logger_id: logger_id.into(), + identity_provider_name: identity_provider_name.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -12472,14 +20851,29 @@ pub mod logger { &self, resource_group_name: impl Into, service_name: impl Into, - logger_id: impl Into, + identity_provider_name: 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(), - logger_id: logger_id.into(), + identity_provider_name: identity_provider_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + identity_provider_name: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + identity_provider_name: identity_provider_name.into(), subscription_id: subscription_id.into(), } } @@ -12514,27 +20908,12 @@ pub mod logger { 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> { + 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/{}/loggers", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -12550,15 +20929,6 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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)?; @@ -12567,7 +20937,7 @@ pub mod logger { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::LoggerCollection = + let rsp_value: models::IdentityProviderList = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -12614,19 +20984,19 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, + pub(crate) identity_provider_name: String, 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.ApiManagement/service/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.identity_provider_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -12646,7 +21016,7 @@ pub mod logger { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::LoggerContract = + let rsp_value: models::IdentityProviderContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -12668,8 +21038,8 @@ pub mod logger { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::LoggerContract), - Ok200(models::LoggerContract), + Created201(models::IdentityProviderContract), + Ok200(models::IdentityProviderContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12698,8 +21068,8 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, - pub(crate) parameters: models::LoggerContract, + pub(crate) identity_provider_name: String, + pub(crate) parameters: models::IdentityProviderCreateContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -12711,12 +21081,12 @@ pub mod logger { 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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.identity_provider_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -12740,13 +21110,13 @@ pub mod logger { 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::LoggerContract = + let rsp_value: models::IdentityProviderContract = 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::LoggerContract = + let rsp_value: models::IdentityProviderContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -12793,21 +21163,21 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, - pub(crate) parameters: models::LoggerUpdateContract, + pub(crate) identity_provider_name: String, + pub(crate) parameters: models::IdentityProviderUpdateParameters, pub(crate) if_match: String, 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.ApiManagement/service/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.identity_provider_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -12829,7 +21199,7 @@ pub mod logger { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::LoggerContract = + let rsp_value: models::IdentityProviderContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -12847,90 +21217,13 @@ pub mod logger { } } } - pub mod delete { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) logger_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/{}/loggers/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.logger_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", "2020-06-01-preview"); - 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 { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12958,23 +21251,24 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, + pub(crate) identity_provider_name: 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<(), Error>> { + 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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.identity_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::HEAD); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12982,13 +21276,15 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + 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(()), + 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 = @@ -13003,144 +21299,7 @@ pub mod logger { } } } -} -pub mod named_value { - use super::models; - 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, - is_key_vault_refresh_failed: None, - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - named_value_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(), - named_value_id: named_value_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - named_value_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(), - named_value_id: named_value_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - named_value_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - named_value_id: named_value_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - named_value_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(), - named_value_id: named_value_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, - named_value_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(), - named_value_id: named_value_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_value( - &self, - resource_group_name: impl Into, - service_name: impl Into, - named_value_id: impl Into, - subscription_id: impl Into, - ) -> list_value::Builder { - list_value::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - named_value_id: named_value_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn refresh_secret( - &self, - resource_group_name: impl Into, - service_name: impl Into, - named_value_id: impl Into, - subscription_id: impl Into, - ) -> refresh_secret::Builder { - refresh_secret::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - named_value_id: named_value_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13169,41 +21328,23 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) identity_provider_name: String, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, - pub(crate) is_key_vault_refresh_failed: 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 is_key_vault_refresh_failed(mut self, is_key_vault_refresh_failed: bool) -> Self { - self.is_key_vault_refresh_failed = Some(is_key_vault_refresh_failed); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/namedValues", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.identity_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13211,31 +21352,13 @@ pub mod named_value { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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()); - } - if let Some(is_key_vault_refresh_failed) = &self.is_key_vault_refresh_failed { - url.query_pairs_mut() - .append_pair("isKeyVaultRefreshFailed", &is_key_vault_refresh_failed.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::NamedValueCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -13250,7 +21373,7 @@ pub mod named_value { } } } - pub mod get { + pub mod list_secrets { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13279,23 +21402,16 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, + pub(crate) identity_provider_name: String, 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.ApiManagement/service/{}/namedValues/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.named_value_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . identity_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13304,6 +21420,7 @@ pub mod named_value { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); 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)?; @@ -13311,7 +21428,7 @@ pub mod named_value { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NamedValueContract = + let rsp_value: models::ClientSecretContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -13329,14 +21446,45 @@ pub mod named_value { } } } - pub mod create_or_update { +} +pub mod issue { + use super::models; + 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, + issue_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(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Created201(models::NamedValueContract), - Ok200(models::NamedValueContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13364,29 +21512,36 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, - pub(crate) parameters: models::NamedValueCreateContract, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + 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> { + 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/{}/namedValues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/issues", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.named_value_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13394,28 +21549,26 @@ pub mod named_value { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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); + 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::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NamedValueContract = - 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::NamedValueContract = + let rsp_value: models::IssueCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -13431,13 +21584,8 @@ pub mod named_value { } } } - pub mod update { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Ok200(models::NamedValueContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13465,25 +21613,23 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, - pub(crate) parameters: models::NamedValueUpdateParameters, - pub(crate) if_match: String, + pub(crate) issue_id: String, 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.ApiManagement/service/{}/namedValues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/issues/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.named_value_id + &self.issue_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13491,20 +21637,17 @@ pub mod named_value { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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.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::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::NamedValueContract = + let rsp_value: models::IssueContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -13520,13 +21663,114 @@ pub mod named_value { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, +} +pub mod logger { + use super::models; + 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, + logger_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(), + logger_id: logger_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + logger_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(), + logger_id: logger_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + logger_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + logger_id: logger_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + logger_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(), + logger_id: logger_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, + logger_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(), + logger_id: logger_id.into(), + subscription_id: subscription_id.into(), + } } + } + pub mod list_by_service { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13554,24 +21798,36 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, - pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/namedValues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.named_value_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13579,15 +21835,27 @@ pub mod named_value { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - req_builder = req_builder.header("If-Match", &self.if_match); + 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 => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoggerCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -13602,7 +21870,7 @@ pub mod named_value { } } } - pub mod get_entity_tag { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13631,23 +21899,23 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, + pub(crate) logger_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/namedValues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.named_value_id + &self.logger_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13661,7 +21929,12 @@ pub mod named_value { let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoggerContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -13676,8 +21949,13 @@ pub mod named_value { } } } - pub mod list_value { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::LoggerContract), + Ok200(models::LoggerContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13705,23 +21983,29 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, + pub(crate) logger_id: String, + pub(crate) parameters: models::LoggerContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/namedValues/{}/listValue", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.named_value_id + &self.logger_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13729,18 +22013,27 @@ pub mod named_value { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + 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::LoggerContract = + 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::NamedValueSecretContract = + let rsp_value: models::LoggerContract = 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)?; @@ -13756,13 +22049,8 @@ pub mod named_value { } } } - pub mod refresh_secret { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Ok200(models::NamedValueContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13790,23 +22078,25 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, + pub(crate) logger_id: String, + pub(crate) parameters: models::LoggerUpdateContract, + pub(crate) if_match: String, 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.ApiManagement/service/{}/namedValues/{}/refreshSecret", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.named_value_id + &self.logger_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13814,19 +22104,19 @@ pub mod named_value { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + 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.header("If-Match", &self.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::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::NamedValueContract = + let rsp_value: models::LoggerContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -13842,42 +22132,13 @@ pub mod named_value { } } } -} -pub mod network_status { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_service( - &self, - subscription_id: impl Into, - resource_group_name: impl Into, - service_name: impl Into, - ) -> list_by_service::Builder { - list_by_service::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_by_location( - &self, - subscription_id: impl Into, - resource_group_name: impl Into, - service_name: impl Into, - location_name: impl Into, - ) -> list_by_location::Builder { - list_by_location::Builder { - client: self.0.clone(), - subscription_id: subscription_id.into(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - location_name: location_name.into(), - } - } - } - pub mod list_by_service { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13903,25 +22164,26 @@ pub mod network_status { #[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) logger_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, Error>> { + 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/{}/networkstatus", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.logger_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13929,18 +22191,15 @@ pub mod network_status { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + 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 => { - 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) - } + 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 = @@ -13955,7 +22214,7 @@ pub mod network_status { } } } - pub mod list_by_location { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13982,25 +22241,25 @@ pub mod network_status { #[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) location_name: String, + pub(crate) logger_id: String, + 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/locations/{}/networkstatus", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.location_name + &self.logger_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14014,12 +22273,7 @@ pub mod network_status { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NetworkStatusContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -14033,56 +22287,141 @@ pub mod network_status { }) } } - } -} -pub mod notification { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_service( + } +} +pub mod named_value { + use super::models; + 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, + is_key_vault_refresh_failed: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_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(), + named_value_id: named_value_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_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(), + named_value_id: named_value_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + named_value_id: named_value_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_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(), + named_value_id: named_value_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, + named_value_id: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + named_value_id: named_value_id.into(), subscription_id: subscription_id.into(), - top: None, - skip: None, } } - pub fn get( + pub fn list_value( &self, resource_group_name: impl Into, service_name: impl Into, - notification_name: impl Into, + named_value_id: impl Into, subscription_id: impl Into, - ) -> get::Builder { - get::Builder { + ) -> list_value::Builder { + list_value::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - notification_name: notification_name.into(), + named_value_id: named_value_id.into(), subscription_id: subscription_id.into(), } } - pub fn create_or_update( + pub fn refresh_secret( &self, resource_group_name: impl Into, service_name: impl Into, - notification_name: impl Into, + named_value_id: impl Into, subscription_id: impl Into, - ) -> create_or_update::Builder { - create_or_update::Builder { + ) -> refresh_secret::Builder { + refresh_secret::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - notification_name: notification_name.into(), + named_value_id: named_value_id.into(), subscription_id: subscription_id.into(), - if_match: None, } } } @@ -14116,10 +22455,16 @@ pub mod notification { 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, + pub(crate) is_key_vault_refresh_failed: 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 @@ -14128,10 +22473,14 @@ pub mod notification { self.skip = Some(skip); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn is_key_vault_refresh_failed(mut self, is_key_vault_refresh_failed: bool) -> Self { + self.is_key_vault_refresh_failed = Some(is_key_vault_refresh_failed); + 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/{}/notifications", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -14147,12 +22496,19 @@ pub mod notification { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + 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()); } + if let Some(is_key_vault_refresh_failed) = &self.is_key_vault_refresh_failed { + url.query_pairs_mut() + .append_pair("isKeyVaultRefreshFailed", &is_key_vault_refresh_failed.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)?; @@ -14161,7 +22517,7 @@ pub mod notification { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NotificationCollection = + let rsp_value: models::NamedValueCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -14208,19 +22564,19 @@ pub mod notification { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, + pub(crate) named_value_id: String, 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.ApiManagement/service/{}/notifications/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.notification_name + &self.named_value_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -14240,7 +22596,7 @@ pub mod notification { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NotificationContract = + let rsp_value: models::NamedValueContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -14260,6 +22616,12 @@ pub mod notification { } pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Created201(models::NamedValueContract), + Ok200(models::NamedValueContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -14287,7 +22649,8 @@ pub mod notification { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, + pub(crate) named_value_id: String, + pub(crate) parameters: models::NamedValueCreateContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -14296,15 +22659,15 @@ pub mod notification { self.if_match = Some(if_match.into()); self } - 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.ApiManagement/service/{}/notifications/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.notification_name + &self.named_value_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -14316,164 +22679,28 @@ pub mod notification { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NotificationContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::CREATED => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ErrorResponse = + let rsp_value: models::NamedValueContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) + Ok(Response::Created201(rsp_value)) } - } - }) - } - } - } -} -pub mod notification_recipient_user { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_notification( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - subscription_id: impl Into, - ) -> list_by_notification::Builder { - list_by_notification::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - notification_name: notification_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - user_id: 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(), - notification_name: notification_name.into(), - user_id: user_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - user_id: 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(), - notification_name: notification_name.into(), - user_id: user_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn check_entity_exists( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - user_id: impl Into, - subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - notification_name: notification_name.into(), - user_id: user_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_notification { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) notification_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.ApiManagement/service/{}/notifications/{}/recipientUsers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientUserCollection = + let rsp_value: models::NamedValueContract = 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)?; @@ -14489,12 +22716,12 @@ pub mod notification_recipient_user { } } } - pub mod create_or_update { + pub mod update { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::RecipientUserContract), - Ok200(models::RecipientUserContract), + Accepted202, + Ok200(models::NamedValueContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14523,17 +22750,25 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) user_id: String, + pub(crate) named_value_id: String, + pub(crate) parameters: models::NamedValueUpdateParameters, + 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/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14541,21 +22776,18 @@ pub mod notification_recipient_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::RecipientUserContract = - 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), http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientUserContract = + let rsp_value: models::NamedValueContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -14607,14 +22839,21 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) user_id: String, + pub(crate) named_value_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/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_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); @@ -14625,6 +22864,7 @@ pub mod notification_recipient_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + 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)?; @@ -14647,12 +22887,10 @@ pub mod notification_recipient_user { } } } - pub mod check_entity_exists { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Error response #response_type")] - NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -14678,14 +22916,20 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) user_id: String, + pub(crate) named_value_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/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_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); @@ -14702,8 +22946,7 @@ pub mod notification_recipient_user { let 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(()), - http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + 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 = @@ -14718,79 +22961,7 @@ pub mod notification_recipient_user { } } } -} -pub mod notification_recipient_email { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_notification( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - subscription_id: impl Into, - ) -> list_by_notification::Builder { - list_by_notification::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - notification_name: notification_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - email: 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(), - notification_name: notification_name.into(), - email: email.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - email: 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(), - notification_name: notification_name.into(), - email: email.into(), - subscription_id: subscription_id.into(), - } - } - pub fn check_entity_exists( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - email: impl Into, - subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - notification_name: notification_name.into(), - email: email.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_notification { + pub mod list_value { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14819,16 +22990,23 @@ pub mod notification_recipient_email { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, + pub(crate) named_value_id: String, 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.ApiManagement/service/{}/notifications/{}/recipientEmails" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}/listValue", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14837,6 +23015,7 @@ pub mod notification_recipient_email { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); 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)?; @@ -14844,7 +23023,7 @@ pub mod notification_recipient_email { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientEmailCollection = + let rsp_value: models::NamedValueSecretContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -14862,12 +23041,12 @@ pub mod notification_recipient_email { } } } - pub mod create_or_update { + pub mod refresh_secret { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::RecipientEmailContract), - Ok200(models::RecipientEmailContract), + Accepted202, + Ok200(models::NamedValueContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14896,17 +23075,23 @@ pub mod notification_recipient_email { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) email: String, + pub(crate) named_value_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/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}/refreshSecret", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14915,20 +23100,16 @@ pub mod notification_recipient_email { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientEmailContract = - 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), http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientEmailContract = + let rsp_value: models::NamedValueContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -14946,13 +23127,42 @@ pub mod notification_recipient_email { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, +} +pub mod network_status { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> list_by_service::Builder { + list_by_service::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_by_location( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + location_name: impl Into, + ) -> list_by_location::Builder { + list_by_location::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + location_name: location_name.into(), + } } + } + pub mod list_by_service { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -14978,19 +23188,25 @@ pub mod notification_recipient_email { #[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) notification_name: String, - pub(crate) email: String, - 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, Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/networkstatus", + 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15004,8 +23220,12 @@ pub mod notification_recipient_email { let rsp = 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::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::ErrorResponse = @@ -15020,12 +23240,10 @@ pub mod notification_recipient_email { } } } - pub mod check_entity_exists { + pub mod list_by_location { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Error response #response_type")] - NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -15049,19 +23267,25 @@ pub mod notification_recipient_email { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) email: String, pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) location_name: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/locations/{}/networkstatus", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.location_name + ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15075,8 +23299,12 @@ pub mod notification_recipient_email { let 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(()), - http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkStatusContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -15092,7 +23320,7 @@ pub mod notification_recipient_email { } } } -pub mod open_id_connect_provider { +pub mod notification { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -15107,7 +23335,6 @@ pub mod open_id_connect_provider { resource_group_name: resource_group_name.into(), service_name: service_name.into(), subscription_id: subscription_id.into(), - filter: None, top: None, skip: None, } @@ -15116,14 +23343,14 @@ pub mod open_id_connect_provider { &self, resource_group_name: impl Into, service_name: impl Into, - opid: impl Into, + notification_name: 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(), - opid: opid.into(), + notification_name: notification_name.into(), subscription_id: subscription_id.into(), } } @@ -15131,86 +23358,18 @@ pub mod open_id_connect_provider { &self, resource_group_name: impl Into, service_name: impl Into, - opid: impl Into, - parameters: impl Into, + notification_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(), service_name: service_name.into(), - opid: opid.into(), - parameters: parameters.into(), + notification_name: notification_name.into(), subscription_id: subscription_id.into(), if_match: None, } } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - opid: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - opid: opid.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - opid: 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(), - opid: opid.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, - opid: 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(), - opid: opid.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_secrets( - &self, - resource_group_name: impl Into, - service_name: impl Into, - opid: impl Into, - subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - opid: opid.into(), - subscription_id: subscription_id.into(), - } - } } pub mod list_by_service { use super::models; @@ -15242,15 +23401,10 @@ pub mod open_id_connect_provider { 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 @@ -15259,12 +23413,10 @@ pub mod open_id_connect_provider { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/openidConnectProviders", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -15280,9 +23432,6 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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()); } @@ -15297,7 +23446,7 @@ pub mod open_id_connect_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OpenIdConnectProviderCollection = + let rsp_value: models::NotificationCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -15344,21 +23493,19 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, + pub(crate) notification_name: String, 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.ApiManagement/service/{}/openidConnectProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.opid + &self.notification_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -15378,7 +23525,7 @@ pub mod open_id_connect_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OpenidConnectProviderContract = + let rsp_value: models::NotificationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -15398,11 +23545,6 @@ pub mod open_id_connect_provider { } pub mod create_or_update { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::OpenidConnectProviderContract), - Ok200(models::OpenidConnectProviderContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15430,8 +23572,7 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, - pub(crate) parameters: models::OpenidConnectProviderContract, + pub(crate) notification_name: String, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -15440,15 +23581,15 @@ pub mod open_id_connect_provider { self.if_match = Some(if_match.into()); self } - 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.ApiManagement/service/{}/openidConnectProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.opid + &self.notification_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -15460,27 +23601,20 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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); } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::OpenidConnectProviderContract = - 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::OpenidConnectProviderContract = + let rsp_value: models::NotificationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -15496,7 +23630,79 @@ pub mod open_id_connect_provider { } } } - pub mod update { +} +pub mod notification_recipient_user { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_notification( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + subscription_id: impl Into, + ) -> list_by_notification::Builder { + list_by_notification::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + user_id: 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(), + notification_name: notification_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + user_id: 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(), + notification_name: notification_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_notification { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -15525,27 +23731,16 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, - pub(crate) parameters: models::OpenidConnectProviderUpdateContract, - pub(crate) if_match: String, + pub(crate) notification_name: String, 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.ApiManagement/service/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15553,9 +23748,7 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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.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)?; @@ -15563,7 +23756,7 @@ pub mod open_id_connect_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OpenidConnectProviderContract = + let rsp_value: models::RecipientUserCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -15581,12 +23774,12 @@ pub mod open_id_connect_provider { } } } - pub mod delete { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200, - NoContent204, + Created201(models::RecipientUserContract), + Ok200(models::RecipientUserContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -15615,24 +23808,17 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, - pub(crate) if_match: String, + pub(crate) notification_name: String, + pub(crate) user_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/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15640,15 +23826,24 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecipientUserContract = + 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::RecipientUserContract = + 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 = @@ -15663,8 +23858,13 @@ pub mod open_id_connect_provider { } } } - pub mod get_entity_tag { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15692,23 +23892,17 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, + pub(crate) notification_name: String, + pub(crate) user_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15722,7 +23916,8 @@ pub mod open_id_connect_provider { let rsp = 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(()), + 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 = @@ -15737,10 +23932,12 @@ pub mod open_id_connect_provider { } } } - pub mod list_secrets { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -15766,16 +23963,17 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, + pub(crate) notification_name: String, + pub(crate) user_id: String, 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<(), Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . opid) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15784,18 +23982,13 @@ pub mod open_id_connect_provider { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); 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::ClientSecretContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + http::StatusCode::NO_CONTENT => Ok(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -15811,91 +24004,78 @@ pub mod open_id_connect_provider { } } } -pub mod policy { +pub mod notification_recipient_email { use super::models; 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(), - } - } - pub fn get( + pub fn list_by_notification( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, + notification_name: impl Into, subscription_id: impl Into, - ) -> get::Builder { - get::Builder { + ) -> list_by_notification::Builder { + list_by_notification::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - policy_id: policy_id.into(), + notification_name: notification_name.into(), subscription_id: subscription_id.into(), - format: None, } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, - parameters: impl Into, + notification_name: impl Into, + email: 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(), - policy_id: policy_id.into(), - parameters: parameters.into(), + notification_name: notification_name.into(), + email: email.into(), subscription_id: subscription_id.into(), - if_match: None, } } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, - if_match: impl Into, + notification_name: impl Into, + email: 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(), - policy_id: policy_id.into(), - if_match: if_match.into(), + notification_name: notification_name.into(), + email: email.into(), subscription_id: subscription_id.into(), } } - pub fn get_entity_tag( + pub fn check_entity_exists( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, + notification_name: impl Into, + email: impl Into, subscription_id: impl Into, - ) -> get_entity_tag::Builder { - get_entity_tag::Builder { + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - policy_id: policy_id.into(), + notification_name: notification_name.into(), + email: email.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_service { + pub mod list_by_notification { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -15924,18 +24104,13 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) notification_name: String, 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.ApiManagement/service/{}/policies", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::GET); @@ -15954,7 +24129,7 @@ pub mod policy { match 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 = + let rsp_value: models::RecipientEmailCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -15972,8 +24147,13 @@ pub mod policy { } } } - pub mod get { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::RecipientEmailContract), + Ok200(models::RecipientEmailContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -16001,28 +24181,101 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, + pub(crate) notification_name: String, + pub(crate) email: String, pub(crate) subscription_id: String, - pub(crate) format: Option, } impl Builder { - pub fn format(mut self, format: impl Into) -> Self { - self.format = Some(format.into()); - self - } - 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.ApiManagement/service/{}/policies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.policy_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let mut url = 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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::RecipientEmailContract = + 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::RecipientEmailContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) notification_name: String, + pub(crate) email: 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/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16030,21 +24283,14 @@ pub mod policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - if let Some(format) = &self.format { - url.query_pairs_mut().append_pair("format", format); - } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PolicyContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -16059,15 +24305,12 @@ pub mod policy { } } } - pub mod create_or_update { + pub mod check_entity_exists { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::PolicyContract), - Ok200(models::PolicyContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -16093,29 +24336,17 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, - pub(crate) parameters: models::PolicyContract, + pub(crate) notification_name: String, + pub(crate) email: String, 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> { + 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/{}/policies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.policy_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; let mut url = 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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16123,28 +24354,14 @@ pub mod policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::PolicyContract = - 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::PolicyContract = - 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(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -16159,13 +24376,129 @@ pub mod policy { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, +} +pub mod open_id_connect_provider { + use super::models; + 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, + opid: 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(), + opid: opid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: 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(), + opid: opid.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + opid: opid.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: 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(), + opid: opid.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, + opid: 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(), + opid: opid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + opid: opid.into(), + subscription_id: subscription_id.into(), + } } + } + pub mod list_by_service { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -16193,24 +24526,38 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, - pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.policy_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16218,15 +24565,27 @@ pub mod policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - req_builder = req_builder.header("If-Match", &self.if_match); + 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 => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenIdConnectProviderCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -16241,7 +24600,7 @@ pub mod policy { } } } - pub mod get_entity_tag { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -16270,23 +24629,25 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, + pub(crate) opid: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.policy_id + &self.opid ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16300,7 +24661,12 @@ pub mod policy { let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenidConnectProviderContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -16315,28 +24681,13 @@ pub mod policy { } } } -} -pub mod policy_description { - use super::models; - 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(), - scope: None, - } - } - } - pub mod list_by_service { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::OpenidConnectProviderContract), + Ok200(models::OpenidConnectProviderContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -16364,28 +24715,29 @@ pub mod policy_description { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) opid: String, + pub(crate) parameters: models::OpenidConnectProviderContract, pub(crate) subscription_id: String, - pub(crate) scope: Option, + pub(crate) if_match: Option, } impl Builder { - pub fn scope(mut self, scope: impl Into) -> Self { - self.scope = Some(scope.into()); + 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> { + 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/{}/policyDescriptions", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.opid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16393,20 +24745,27 @@ pub mod policy_description { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - if let Some(scope) = &self.scope { - url.query_pairs_mut().append_pair("scope", scope); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::OpenidConnectProviderContract = + 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::PolicyDescriptionCollection = + let rsp_value: models::OpenidConnectProviderContract = 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)?; @@ -16422,95 +24781,7 @@ pub mod policy_description { } } } -} -pub mod portal_revision { - use super::models; - 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, - portal_revision_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(), - portal_revision_id: portal_revision_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - portal_revision_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(), - portal_revision_id: portal_revision_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - portal_revision_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - portal_revision_id: portal_revision_id.into(), - parameters: parameters.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, - portal_revision_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(), - portal_revision_id: portal_revision_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -16539,36 +24810,27 @@ pub mod portal_revision { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) opid: String, + pub(crate) parameters: models::OpenidConnectProviderUpdateContract, + pub(crate) if_match: 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> { + 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/{}/portalRevisions", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.opid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16576,16 +24838,9 @@ pub mod portal_revision { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.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)?; @@ -16593,7 +24848,7 @@ pub mod portal_revision { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalRevisionCollection = + let rsp_value: models::OpenidConnectProviderContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -16611,8 +24866,13 @@ pub mod portal_revision { } } } - pub mod get { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -16640,23 +24900,24 @@ pub mod portal_revision { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) portal_revision_id: String, + pub(crate) opid: 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> { + 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/{}/portalRevisions/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.portal_revision_id + &self.opid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16664,18 +24925,15 @@ pub mod portal_revision { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalRevisionContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -16690,13 +24948,8 @@ pub mod portal_revision { } } } - pub mod create_or_update { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Created201(models::PortalRevisionContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -16724,45 +24977,37 @@ pub mod portal_revision { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) portal_revision_id: String, - pub(crate) parameters: models::PortalRevisionContract, + pub(crate) opid: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.portal_revision_id + &self.opid ); let mut url = 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); + 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", "2020-06-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalRevisionContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Created201(rsp_value)) - } + 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 = @@ -16777,13 +25022,8 @@ pub mod portal_revision { } } } - pub mod update { + pub mod list_secrets { use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Ok200(models::PortalRevisionContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -16811,25 +25051,16 @@ pub mod portal_revision { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) portal_revision_id: String, - pub(crate) parameters: models::PortalRevisionContract, - pub(crate) if_match: String, + pub(crate) opid: String, 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.ApiManagement/service/{}/portalRevisions/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.portal_revision_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . opid) ; let mut url = 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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16837,20 +25068,18 @@ pub mod portal_revision { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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.header("If-Match", &self.if_match); + 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::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalRevisionContract = + let rsp_value: models::ClientSecretContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -16866,7 +25095,92 @@ pub mod portal_revision { } } } - pub mod get_entity_tag { +} +pub mod policy { + use super::models; + 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(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + policy_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(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + format: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + policy_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(), + policy_id: policy_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, + policy_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(), + policy_id: policy_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, + policy_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(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -16895,23 +25209,21 @@ pub mod portal_revision { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) portal_revision_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/portalRevisions/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.portal_revision_id + &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::HEAD); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16925,7 +25237,12 @@ pub mod portal_revision { let rsp = 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(()), + 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)?; let rsp_value: models::ErrorResponse = @@ -16940,26 +25257,7 @@ pub mod portal_revision { } } } -} -pub mod portal_settings { - use super::models; - 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(), - } - } - } - pub mod list_by_service { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -16988,17 +25286,24 @@ pub mod portal_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) policy_id: String, pub(crate) subscription_id: String, + pub(crate) format: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.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/{}/portalsettings", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -17010,6 +25315,9 @@ pub mod portal_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -17018,7 +25326,7 @@ pub mod portal_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSettingsCollection = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -17036,73 +25344,13 @@ pub mod portal_settings { } } } -} -pub mod sign_in_settings { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - resource_group_name: impl Into, - service_name: 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(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - 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(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - parameters: parameters.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, - 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(), - subscription_id: subscription_id.into(), - } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), } - } - pub mod get { - use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -17130,21 +25378,29 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17152,17 +25408,27 @@ pub mod sign_in_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::PolicyContract = + 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::PortalSigninSettings = + let rsp_value: models::PolicyContract = 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)?; @@ -17178,8 +25444,13 @@ pub mod sign_in_settings { } } } - pub mod create_or_update { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -17207,27 +25478,24 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSigninSettings, + pub(crate) policy_id: String, + pub(crate) if_match: String, 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> { + 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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17235,22 +25503,15 @@ pub mod sign_in_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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.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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSigninSettings = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -17265,7 +25526,7 @@ pub mod sign_in_settings { } } } - pub mod update { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17294,23 +25555,23 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSigninSettings, - pub(crate) if_match: String, + pub(crate) policy_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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17318,15 +25579,13 @@ pub mod sign_in_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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.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::NO_CONTENT => Ok(()), + 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 = @@ -17341,7 +25600,27 @@ pub mod sign_in_settings { } } } - pub mod get_entity_tag { +} +pub mod policy_description { + use super::models; + 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(), + scope: None, + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17371,12 +25650,19 @@ pub mod sign_in_settings { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) subscription_id: String, + pub(crate) scope: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + pub fn scope(mut self, scope: impl Into) -> Self { + self.scope = Some(scope.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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policyDescriptions", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -17384,7 +25670,7 @@ pub mod sign_in_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17392,13 +25678,21 @@ pub mod sign_in_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + if let Some(scope) = &self.scope { + url.query_pairs_mut().append_pair("scope", scope); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyDescriptionCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -17414,20 +25708,38 @@ pub mod sign_in_settings { } } } -pub mod sign_up_settings { +pub mod portal_revision { use super::models; 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, + portal_revision_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(), + portal_revision_id: portal_revision_id.into(), subscription_id: subscription_id.into(), } } @@ -17435,23 +25747,25 @@ pub mod sign_up_settings { &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + portal_revision_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(), + portal_revision_id: portal_revision_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), - if_match: None, } } pub fn update( &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + portal_revision_id: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -17459,6 +25773,7 @@ pub mod sign_up_settings { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + portal_revision_id: portal_revision_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), @@ -17468,16 +25783,119 @@ pub mod sign_up_settings { &self, resource_group_name: impl Into, service_name: impl Into, + portal_revision_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(), + portal_revision_id: portal_revision_id.into(), subscription_id: subscription_id.into(), } } } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/portalRevisions", + 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", "2020-06-01-preview"); + 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::PortalRevisionCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; #[derive(Debug, thiserror :: Error)] @@ -17507,17 +25925,19 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) portal_revision_id: String, 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.ApiManagement/service/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.portal_revision_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -17537,7 +25957,7 @@ pub mod sign_up_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSignupSettings = + let rsp_value: models::PortalRevisionContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -17557,6 +25977,11 @@ pub mod sign_up_settings { } pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Created201(models::PortalRevisionContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -17584,23 +26009,20 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSignupSettings, + pub(crate) portal_revision_id: String, + pub(crate) parameters: models::PortalRevisionContract, 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> { + 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/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.portal_revision_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -17614,19 +26036,17 @@ pub mod sign_up_settings { url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); 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::OK => { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::CREATED => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSignupSettings = + let rsp_value: models::PortalRevisionContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + Ok(Response::Created201(rsp_value)) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -17644,6 +26064,11 @@ pub mod sign_up_settings { } pub mod update { use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::PortalRevisionContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -17671,19 +26096,21 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSignupSettings, + pub(crate) portal_revision_id: String, + pub(crate) parameters: models::PortalRevisionContract, pub(crate) if_match: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.portal_revision_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -17703,7 +26130,13 @@ pub mod sign_up_settings { let 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(()), + 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::PortalRevisionContract = + 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 = @@ -17747,17 +26180,19 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) portal_revision_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/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.portal_revision_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -17791,76 +26226,17 @@ pub mod sign_up_settings { } } } -pub mod delegation_settings { +pub mod portal_settings { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn get( - &self, - resource_group_name: impl Into, - service_name: 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(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - 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(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - parameters: parameters.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, - 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(), - subscription_id: subscription_id.into(), - } - } - pub fn list_secrets( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), @@ -17868,7 +26244,7 @@ pub mod delegation_settings { } } } - pub mod get { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17900,10 +26276,10 @@ pub mod delegation_settings { 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.ApiManagement/service/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -17927,7 +26303,7 @@ pub mod delegation_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalDelegationSettings = + let rsp_value: models::PortalSettingsCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -17945,7 +26321,72 @@ pub mod delegation_settings { } } } - pub mod create_or_update { +} +pub mod sign_in_settings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + service_name: 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(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + 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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.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, + 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(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17974,19 +26415,13 @@ pub mod delegation_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalDelegationSettings, 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> { + 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/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -17994,7 +26429,7 @@ pub mod delegation_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18002,11 +26437,7 @@ pub mod delegation_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -18014,7 +26445,7 @@ pub mod delegation_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalDelegationSettings = + let rsp_value: models::PortalSigninSettings = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -18032,7 +26463,7 @@ pub mod delegation_settings { } } } - pub mod update { + pub mod create_or_update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18061,15 +26492,19 @@ pub mod delegation_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalDelegationSettings, - pub(crate) if_match: String, + pub(crate) parameters: models::PortalSigninSettings, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -18077,7 +26512,7 @@ pub mod delegation_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18087,13 +26522,20 @@ pub mod delegation_settings { url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); 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.header("If-Match", &self.if_match); + 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::NO_CONTENT => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalSigninSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -18108,7 +26550,7 @@ pub mod delegation_settings { } } } - pub mod get_entity_tag { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18137,13 +26579,15 @@ pub mod delegation_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) parameters: models::PortalSigninSettings, + pub(crate) if_match: 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/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -18151,7 +26595,7 @@ pub mod delegation_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18159,13 +26603,15 @@ pub mod delegation_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => Ok(()), + 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::ErrorResponse = @@ -18180,7 +26626,7 @@ pub mod delegation_settings { } } } - pub mod list_secrets { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18212,14 +26658,18 @@ pub mod delegation_settings { 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<(), Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", + 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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18228,18 +26678,12 @@ pub mod delegation_settings { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); 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::PortalSettingValidationKeyContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -18255,40 +26699,20 @@ pub mod delegation_settings { } } } -pub mod product { +pub mod sign_up_settings { use super::models; 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, - expand_groups: None, - tags: None, - } - } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - product_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(), - product_id: product_id.into(), subscription_id: subscription_id.into(), } } @@ -18296,15 +26720,13 @@ pub mod product { &self, resource_group_name: impl Into, service_name: impl Into, - product_id: impl Into, - parameters: 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(), - product_id: product_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -18314,8 +26736,7 @@ pub mod product { &self, resource_group_name: impl Into, service_name: impl Into, - product_id: impl Into, - parameters: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -18323,64 +26744,190 @@ pub mod product { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - product_id: product_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_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(), - product_id: product_id.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - delete_subscriptions: None, - } - } pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, - product_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(), - product_id: product_id.into(), subscription_id: subscription_id.into(), } } - pub fn list_by_tags( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> list_by_tags::Builder { - list_by_tags::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, - include_not_tagged_products: None, + } + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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, + } + impl Builder { + 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/{}/portalsettings/signup", + 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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalSignupSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) parameters: models::PortalSignupSettings, + 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/{}/portalsettings/signup", + 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", "2020-06-01-preview"); + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalSignupSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_service { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18409,38 +26956,15 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) parameters: models::PortalSignupSettings, + pub(crate) if_match: String, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, - pub(crate) expand_groups: Option, - pub(crate) tags: 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 expand_groups(mut self, expand_groups: bool) -> Self { - self.expand_groups = Some(expand_groups); - self - } - pub fn tags(mut self, tags: impl Into) -> Self { - self.tags = Some(tags.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/products", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -18448,7 +26972,7 @@ pub mod product { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18456,33 +26980,15 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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()); - } - if let Some(expand_groups) = &self.expand_groups { - url.query_pairs_mut().append_pair("expandGroups", &expand_groups.to_string()); - } - if let Some(tags) = &self.tags { - url.query_pairs_mut().append_pair("tags", tags); - } - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProductCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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::ErrorResponse = @@ -18497,7 +27003,7 @@ pub mod product { } } } - pub mod get { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18526,23 +27032,21 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18556,12 +27060,7 @@ pub mod product { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProductContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -18576,13 +27075,86 @@ pub mod product { } } } - pub mod create_or_update { - use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ProductContract), - Ok200(models::ProductContract), +} +pub mod delegation_settings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + service_name: 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(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + 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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.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, + 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(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -18610,29 +27182,21 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) parameters: models::ProductContract, 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> { + 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18640,27 +27204,17 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ProductContract = - 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::ProductContract = + let rsp_value: models::PortalDelegationSettings = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -18676,7 +27230,7 @@ pub mod product { } } } - pub mod update { + pub mod create_or_update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18705,25 +27259,27 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) parameters: models::ProductUpdateParameters, - pub(crate) if_match: String, + pub(crate) parameters: models::PortalDelegationSettings, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18733,7 +27289,9 @@ pub mod product { url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); 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.header("If-Match", &self.if_match); + 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)?; @@ -18741,7 +27299,7 @@ pub mod product { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProductContract = + let rsp_value: models::PortalDelegationSettings = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -18759,13 +27317,8 @@ pub mod product { } } } - pub mod delete { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -18793,29 +27346,23 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, + pub(crate) parameters: models::PortalDelegationSettings, pub(crate) if_match: String, pub(crate) subscription_id: String, - pub(crate) delete_subscriptions: Option, } impl Builder { - pub fn delete_subscriptions(mut self, delete_subscriptions: bool) -> Self { - self.delete_subscriptions = Some(delete_subscriptions); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18823,19 +27370,15 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + 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.header("If-Match", &self.if_match); - if let Some(delete_subscriptions) = &self.delete_subscriptions { - url.query_pairs_mut() - .append_pair("deleteSubscriptions", &delete_subscriptions.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::NO_CONTENT => Ok(Response::NoContent204), + 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::ErrorResponse = @@ -18879,19 +27422,17 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &self.service_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -18924,7 +27465,7 @@ pub mod product { } } } - pub mod list_by_tags { + pub mod list_secrets { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18954,40 +27495,16 @@ pub mod product { 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, - pub(crate) include_not_tagged_products: 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 include_not_tagged_products(mut self, include_not_tagged_products: bool) -> Self { - self.include_not_tagged_products = Some(include_not_tagged_products); - self - } - 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.ApiManagement/service/{}/productsByTags", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation/listSecrets" , 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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18995,20 +27512,8 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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()); - } - if let Some(include_not_tagged_products) = &self.include_not_tagged_products { - url.query_pairs_mut() - .append_pair("includeNotTaggedProducts", &include_not_tagged_products.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)?; @@ -19016,7 +27521,7 @@ pub mod product { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagResourceCollection = + let rsp_value: models::PortalSettingValidationKeyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -19035,26 +27540,41 @@ pub mod product { } } } -pub mod product_api { +pub mod product { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_product( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - product_id: impl Into, subscription_id: impl Into, - ) -> list_by_product::Builder { - list_by_product::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - product_id: product_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, + expand_groups: None, + tags: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_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(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), } } pub fn create_or_update( @@ -19062,7 +27582,7 @@ pub mod product_api { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - api_id: impl Into, + parameters: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -19070,7 +27590,27 @@ pub mod product_api { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - api_id: api_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } @@ -19079,7 +27619,7 @@ pub mod product_api { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - api_id: impl Into, + if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { delete::Builder { @@ -19087,138 +27627,46 @@ pub mod product_api { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - api_id: api_id.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), + delete_subscriptions: None, } } - pub fn check_entity_exists( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - api_id: impl Into, subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - api_id: api_id.into(), subscription_id: subscription_id.into(), } } - } - pub mod list_by_product { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: 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/{}/products/{}/apis", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_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", "2020-06-01-preview"); - 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::ApiCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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 list_by_tags( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_tags::Builder { + list_by_tags::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, + include_not_tagged_products: None, } } } - pub mod create_or_update { + pub mod list_by_service { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ApiContract), - Ok200(models::ApiContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -19246,25 +27694,46 @@ pub mod product_api { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) api_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) expand_groups: Option, + pub(crate) tags: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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 expand_groups(mut self, expand_groups: bool) -> Self { + self.expand_groups = Some(expand_groups); + self + } + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.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/{}/products/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.api_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -19272,106 +27741,33 @@ pub mod product_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + 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()); + } + if let Some(expand_groups) = &self.expand_groups { + url.query_pairs_mut().append_pair("expandGroups", &expand_groups.to_string()); + } + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ApiContract = - 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::ApiContract = - 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 = + let rsp_value: models::ProductCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) + Ok(rsp_value) } - } - }) - } - } - } - pub mod delete { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: String, - pub(crate) api_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/{}/products/{}/apis/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.api_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", "2020-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = 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 = @@ -19386,7 +27782,7 @@ pub mod product_api { } } } - pub mod check_entity_exists { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -19416,24 +27812,22 @@ pub mod product_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) api_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/products/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.api_id + &self.product_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -19447,98 +27841,33 @@ pub mod product_api { let 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 => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ErrorResponse = + let rsp_value: models::ProductContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) + Ok(rsp_value) } - } - }) - } - } - } -} -pub mod product_group { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - subscription_id: impl Into, - ) -> list_by_product::Builder { - list_by_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - group_id: 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(), - product_id: product_id.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - group_id: 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(), - product_id: product_id.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn check_entity_exists( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - group_id: impl Into, - subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), + 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_product { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ProductContract), + Ok200(models::ProductContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -19567,28 +27896,19 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, + pub(crate) parameters: models::ProductContract, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, + pub(crate) if_match: 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); + 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> { + 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/{}/products/{}/groups", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -19597,7 +27917,7 @@ pub mod product_group { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -19605,26 +27925,27 @@ pub mod product_group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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()); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ProductContract = + 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::GroupCollection = + let rsp_value: models::ProductContract = 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)?; @@ -19640,13 +27961,8 @@ pub mod product_group { } } } - pub mod create_or_update { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::GroupContract), - Ok200(models::GroupContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -19675,24 +27991,24 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) group_id: String, + pub(crate) parameters: models::ProductUpdateParameters, + pub(crate) if_match: String, 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.ApiManagement/service/{}/products/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.group_id + &self.product_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -19700,23 +28016,19 @@ pub mod product_group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::GroupContract = - 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::GroupContract = + let rsp_value: models::ProductContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -19767,20 +28079,24 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) group_id: String, + pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) delete_subscriptions: Option, } impl Builder { + pub fn delete_subscriptions(mut self, delete_subscriptions: bool) -> Self { + self.delete_subscriptions = Some(delete_subscriptions); + 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/{}/products/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.group_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -19792,6 +28108,11 @@ pub mod product_group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + if let Some(delete_subscriptions) = &self.delete_subscriptions { + url.query_pairs_mut() + .append_pair("deleteSubscriptions", &delete_subscriptions.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)?; @@ -19814,7 +28135,7 @@ pub mod product_group { } } } - pub mod check_entity_exists { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -19844,20 +28165,18 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) group_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/{}/products/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.group_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -19875,7 +28194,7 @@ pub mod product_group { let 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(()), + 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 = @@ -19890,31 +28209,7 @@ pub mod product_group { } } } -} -pub mod product_subscriptions { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - } - pub mod list { + pub mod list_by_tags { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -19943,11 +28238,11 @@ pub mod product_subscriptions { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, + pub(crate) include_not_tagged_products: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -19962,15 +28257,18 @@ pub mod product_subscriptions { self.skip = Some(skip); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn include_not_tagged_products(mut self, include_not_tagged_products: bool) -> Self { + self.include_not_tagged_products = Some(include_not_tagged_products); + 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/{}/products/{}/subscriptions", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/productsByTags", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &self.service_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -19991,6 +28289,10 @@ pub mod product_subscriptions { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } + if let Some(include_not_tagged_products) = &self.include_not_tagged_products { + url.query_pairs_mut() + .append_pair("includeNotTaggedProducts", &include_not_tagged_products.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)?; @@ -19999,7 +28301,7 @@ pub mod product_subscriptions { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::SubscriptionCollection = + let rsp_value: models::TagResourceCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -20018,7 +28320,7 @@ pub mod product_subscriptions { } } } -pub mod product_policy { +pub mod product_api { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -20035,24 +28337,9 @@ pub mod product_policy { service_name: service_name.into(), product_id: product_id.into(), subscription_id: subscription_id.into(), - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - policy_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(), - product_id: product_id.into(), - policy_id: policy_id.into(), - subscription_id: subscription_id.into(), - format: None, + filter: None, + top: None, + skip: None, } } pub fn create_or_update( @@ -20060,8 +28347,7 @@ pub mod product_policy { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - policy_id: impl Into, - parameters: impl Into, + api_id: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -20069,10 +28355,8 @@ pub mod product_policy { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - policy_id: policy_id.into(), - parameters: parameters.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), - if_match: None, } } pub fn delete( @@ -20080,8 +28364,7 @@ pub mod product_policy { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - policy_id: impl Into, - if_match: impl Into, + api_id: impl Into, subscription_id: impl Into, ) -> delete::Builder { delete::Builder { @@ -20089,109 +28372,29 @@ pub mod product_policy { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - policy_id: policy_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, - product_id: impl Into, - policy_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(), - product_id: product_id.into(), - policy_id: policy_id.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_product { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_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/{}/products/{}/policies", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_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", "2020-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match 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)?; - 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 check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), } } } - pub mod get { + pub mod list_by_product { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -20221,25 +28424,33 @@ pub mod product_policy { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) policy_id: String, pub(crate) subscription_id: String, - pub(crate) format: Option, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn format(mut self, format: impl Into) -> Self { - self.format = Some(format.into()); + 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> { + 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/{}/products/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.policy_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -20251,8 +28462,14 @@ pub mod product_policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - if let Some(format) = &self.format { - url.query_pairs_mut().append_pair("format", format); + 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()); @@ -20262,7 +28479,7 @@ pub mod product_policy { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PolicyContract = + let rsp_value: models::ApiCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -20284,8 +28501,8 @@ pub mod product_policy { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::PolicyContract), - Ok200(models::PolicyContract), + Created201(models::ApiContract), + Ok200(models::ApiContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -20315,26 +28532,20 @@ pub mod product_policy { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) policy_id: String, - pub(crate) parameters: models::PolicyContract, + pub(crate) api_id: String, 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/{}/products/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.policy_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -20346,11 +28557,7 @@ pub mod product_policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - if let Some(if_match) = &self.if_match { - req_builder = req_builder.header("If-Match", if_match); - } - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -20358,13 +28565,13 @@ pub mod product_policy { 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::PolicyContract = + let rsp_value: models::ApiContract = 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::PolicyContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -20417,21 +28624,20 @@ pub mod product_policy { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) policy_id: String, - pub(crate) if_match: String, + pub(crate) api_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/{}/products/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.policy_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -20443,7 +28649,6 @@ pub mod product_policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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)?; @@ -20466,7 +28671,7 @@ pub mod product_policy { } } } - pub mod get_entity_tag { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -20492,213 +28697,93 @@ pub mod product_policy { } #[derive(Clone)] pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) policy_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/{}/products/{}/policies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.policy_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", "2020-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = 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 tag { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - subscription_id: impl Into, - ) -> list_by_product::Builder { - list_by_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - pub fn get_by_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - tag_id: impl Into, - subscription_id: impl Into, - ) -> get_by_product::Builder { - get_by_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn assign_to_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - tag_id: impl Into, - subscription_id: impl Into, - ) -> assign_to_product::Builder { - assign_to_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn detach_from_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - tag_id: impl Into, - subscription_id: impl Into, - ) -> detach_from_product::Builder { - detach_from_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) api_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/{}/products/{}/apis/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.api_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", "2020-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::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 get_entity_state_by_product( + } +} +pub mod product_group { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_product( &self, resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - tag_id: impl Into, subscription_id: impl Into, - ) -> get_entity_state_by_product::Builder { - get_entity_state_by_product::Builder { + ) -> list_by_product::Builder { + list_by_product::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), - } - } - 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, - scope: None, - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - tag_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(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - tag_id: impl Into, - parameters: impl Into, + product_id: impl Into, + group_id: 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(), - tag_id: tag_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - tag_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - tag_id: tag_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), + product_id: product_id.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -20706,31 +28791,33 @@ pub mod tag { &self, resource_group_name: impl Into, service_name: impl Into, - tag_id: impl Into, - if_match: impl Into, + product_id: impl Into, + group_id: 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(), - tag_id: tag_id.into(), - if_match: if_match.into(), + product_id: product_id.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } - pub fn get_entity_state( + pub fn check_entity_exists( &self, resource_group_name: impl Into, service_name: impl Into, - tag_id: impl Into, + product_id: impl Into, + group_id: impl Into, subscription_id: impl Into, - ) -> get_entity_state::Builder { - get_entity_state::Builder { + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - tag_id: tag_id.into(), + product_id: product_id.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -20783,10 +28870,10 @@ pub mod tag { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/products/{}/tags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -20820,88 +28907,7 @@ pub mod tag { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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_product { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: String, - pub(crate) tag_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/{}/products/{}/tags/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.tag_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", "2020-06-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagContract = + let rsp_value: models::GroupCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -20919,12 +28925,12 @@ pub mod tag { } } } - pub mod assign_to_product { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::TagContract), - Ok200(models::TagContract), + Created201(models::GroupContract), + Ok200(models::GroupContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -20954,20 +28960,20 @@ pub mod tag { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) tag_id: String, + pub(crate) group_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/{}/products/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.tag_id + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -20987,13 +28993,13 @@ pub mod tag { 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::TagContract = + let rsp_value: models::GroupContract = 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::TagContract = + let rsp_value: models::GroupContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -21011,7 +29017,7 @@ pub mod tag { } } } - pub mod detach_from_product { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { @@ -21046,20 +29052,20 @@ pub mod tag { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) tag_id: String, + pub(crate) group_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/{}/products/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.tag_id + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -21093,7 +29099,7 @@ pub mod tag { } } } - pub mod get_entity_state_by_product { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -21123,20 +29129,20 @@ pub mod tag { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) tag_id: String, + pub(crate) group_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/{}/products/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.tag_id + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -21154,7 +29160,7 @@ pub mod tag { let rsp = 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(()), + 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::ErrorResponse = @@ -21169,7 +29175,31 @@ pub mod tag { } } } - pub mod list_by_service { +} +pub mod product_subscriptions { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -21198,11 +29228,11 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) product_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, - pub(crate) scope: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -21217,18 +29247,15 @@ pub mod tag { self.skip = Some(skip); self } - pub fn scope(mut self, scope: impl Into) -> Self { - self.scope = Some(scope.into()); - self - } - 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.ApiManagement/service/{}/tags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/subscriptions", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -21249,9 +29276,6 @@ pub mod tag { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } - if let Some(scope) = &self.scope { - url.query_pairs_mut().append_pair("scope", scope); - } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -21260,7 +29284,7 @@ pub mod tag { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagCollection = + let rsp_value: models::SubscriptionCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -21278,7 +29302,102 @@ pub mod tag { } } } - pub mod get { +} +pub mod product_policy { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list_by_product::Builder { + list_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + format: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_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, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_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, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_product { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -21307,19 +29426,19 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, + pub(crate) product_id: String, 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.ApiManagement/service/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -21339,7 +29458,7 @@ pub mod tag { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagContract = + let rsp_value: models::PolicyCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -21357,13 +29476,8 @@ pub mod tag { } } } - pub mod create_or_update { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::TagContract), - Ok200(models::TagContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -21391,29 +29505,30 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, - pub(crate) parameters: models::TagCreateUpdateParameters, + pub(crate) product_id: String, + pub(crate) policy_id: String, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) format: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.into()); self } - 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.ApiManagement/service/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -21421,27 +29536,20 @@ pub mod tag { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); - 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); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::TagContract = - 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::TagContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -21457,8 +29565,13 @@ pub mod tag { } } } - pub mod update { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -21486,25 +29599,31 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, - pub(crate) parameters: models::TagCreateUpdateParameters, - pub(crate) if_match: String, + pub(crate) product_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -21512,19 +29631,27 @@ pub mod tag { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2020-06-01-preview"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } 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.header("If-Match", &self.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::PolicyContract = + 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::TagContract = + let rsp_value: models::PolicyContract = 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)?; @@ -21574,7 +29701,8 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, + pub(crate) product_id: String, + pub(crate) policy_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -21582,12 +29710,13 @@ pub mod tag { 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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -21622,7 +29751,7 @@ pub mod tag { } } } - pub mod get_entity_state { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -21651,19 +29780,21 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, + pub(crate) product_id: String, + pub(crate) policy_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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); diff --git a/services/mgmt/apimanagement/src/package_preview_2021_01/operations.rs b/services/mgmt/apimanagement/src/package_preview_2021_01/operations.rs index a470646a9f..087045dd3d 100644 --- a/services/mgmt/apimanagement/src/package_preview_2021_01/operations.rs +++ b/services/mgmt/apimanagement/src/package_preview_2021_01/operations.rs @@ -77,9 +77,21 @@ impl Client { pub fn api(&self) -> api::Client { api::Client(self.clone()) } + pub fn api_diagnostic(&self) -> api_diagnostic::Client { + api_diagnostic::Client(self.clone()) + } pub fn api_export(&self) -> api_export::Client { api_export::Client(self.clone()) } + pub fn api_issue(&self) -> api_issue::Client { + api_issue::Client(self.clone()) + } + pub fn api_issue_attachment(&self) -> api_issue_attachment::Client { + api_issue_attachment::Client(self.clone()) + } + pub fn api_issue_comment(&self) -> api_issue_comment::Client { + api_issue_comment::Client(self.clone()) + } pub fn api_management_operations(&self) -> api_management_operations::Client { api_management_operations::Client(self.clone()) } @@ -92,6 +104,30 @@ impl Client { pub fn api_management_skus(&self) -> api_management_skus::Client { api_management_skus::Client(self.clone()) } + pub fn api_operation(&self) -> api_operation::Client { + api_operation::Client(self.clone()) + } + pub fn api_operation_policy(&self) -> api_operation_policy::Client { + api_operation_policy::Client(self.clone()) + } + pub fn api_policy(&self) -> api_policy::Client { + api_policy::Client(self.clone()) + } + pub fn api_product(&self) -> api_product::Client { + api_product::Client(self.clone()) + } + pub fn api_release(&self) -> api_release::Client { + api_release::Client(self.clone()) + } + pub fn api_revision(&self) -> api_revision::Client { + api_revision::Client(self.clone()) + } + pub fn api_schema(&self) -> api_schema::Client { + api_schema::Client(self.clone()) + } + pub fn api_tag_description(&self) -> api_tag_description::Client { + api_tag_description::Client(self.clone()) + } pub fn api_version_set(&self) -> api_version_set::Client { api_version_set::Client(self.clone()) } @@ -170,6 +206,9 @@ impl Client { pub fn open_id_connect_provider(&self) -> open_id_connect_provider::Client { open_id_connect_provider::Client(self.clone()) } + pub fn operation(&self) -> operation::Client { + operation::Client(self.clone()) + } pub fn policy(&self) -> policy::Client { policy::Client(self.clone()) } @@ -259,6 +298,152 @@ pub enum Error { #[error(transparent)] ApiExport_Get(#[from] api_export::get::Error), #[error(transparent)] + Api_ListByService(#[from] api::list_by_service::Error), + #[error(transparent)] + Api_Get(#[from] api::get::Error), + #[error(transparent)] + Api_CreateOrUpdate(#[from] api::create_or_update::Error), + #[error(transparent)] + Api_Update(#[from] api::update::Error), + #[error(transparent)] + Api_Delete(#[from] api::delete::Error), + #[error(transparent)] + Api_GetEntityTag(#[from] api::get_entity_tag::Error), + #[error(transparent)] + ApiRevision_ListByService(#[from] api_revision::list_by_service::Error), + #[error(transparent)] + ApiRelease_ListByService(#[from] api_release::list_by_service::Error), + #[error(transparent)] + ApiRelease_Get(#[from] api_release::get::Error), + #[error(transparent)] + ApiRelease_CreateOrUpdate(#[from] api_release::create_or_update::Error), + #[error(transparent)] + ApiRelease_Update(#[from] api_release::update::Error), + #[error(transparent)] + ApiRelease_Delete(#[from] api_release::delete::Error), + #[error(transparent)] + ApiRelease_GetEntityTag(#[from] api_release::get_entity_tag::Error), + #[error(transparent)] + ApiOperation_ListByApi(#[from] api_operation::list_by_api::Error), + #[error(transparent)] + ApiOperation_Get(#[from] api_operation::get::Error), + #[error(transparent)] + ApiOperation_CreateOrUpdate(#[from] api_operation::create_or_update::Error), + #[error(transparent)] + ApiOperation_Update(#[from] api_operation::update::Error), + #[error(transparent)] + ApiOperation_Delete(#[from] api_operation::delete::Error), + #[error(transparent)] + ApiOperation_GetEntityTag(#[from] api_operation::get_entity_tag::Error), + #[error(transparent)] + ApiOperationPolicy_ListByOperation(#[from] api_operation_policy::list_by_operation::Error), + #[error(transparent)] + ApiOperationPolicy_Get(#[from] api_operation_policy::get::Error), + #[error(transparent)] + ApiOperationPolicy_CreateOrUpdate(#[from] api_operation_policy::create_or_update::Error), + #[error(transparent)] + ApiOperationPolicy_Delete(#[from] api_operation_policy::delete::Error), + #[error(transparent)] + ApiOperationPolicy_GetEntityTag(#[from] api_operation_policy::get_entity_tag::Error), + #[error(transparent)] + Tag_ListByOperation(#[from] tag::list_by_operation::Error), + #[error(transparent)] + Tag_GetByOperation(#[from] tag::get_by_operation::Error), + #[error(transparent)] + Tag_AssignToOperation(#[from] tag::assign_to_operation::Error), + #[error(transparent)] + Tag_DetachFromOperation(#[from] tag::detach_from_operation::Error), + #[error(transparent)] + Tag_GetEntityStateByOperation(#[from] tag::get_entity_state_by_operation::Error), + #[error(transparent)] + ApiProduct_ListByApis(#[from] api_product::list_by_apis::Error), + #[error(transparent)] + ApiPolicy_ListByApi(#[from] api_policy::list_by_api::Error), + #[error(transparent)] + ApiPolicy_Get(#[from] api_policy::get::Error), + #[error(transparent)] + ApiPolicy_CreateOrUpdate(#[from] api_policy::create_or_update::Error), + #[error(transparent)] + ApiPolicy_Delete(#[from] api_policy::delete::Error), + #[error(transparent)] + ApiPolicy_GetEntityTag(#[from] api_policy::get_entity_tag::Error), + #[error(transparent)] + ApiSchema_ListByApi(#[from] api_schema::list_by_api::Error), + #[error(transparent)] + ApiSchema_Get(#[from] api_schema::get::Error), + #[error(transparent)] + ApiSchema_CreateOrUpdate(#[from] api_schema::create_or_update::Error), + #[error(transparent)] + ApiSchema_Delete(#[from] api_schema::delete::Error), + #[error(transparent)] + ApiSchema_GetEntityTag(#[from] api_schema::get_entity_tag::Error), + #[error(transparent)] + ApiDiagnostic_ListByService(#[from] api_diagnostic::list_by_service::Error), + #[error(transparent)] + ApiDiagnostic_Get(#[from] api_diagnostic::get::Error), + #[error(transparent)] + ApiDiagnostic_CreateOrUpdate(#[from] api_diagnostic::create_or_update::Error), + #[error(transparent)] + ApiDiagnostic_Update(#[from] api_diagnostic::update::Error), + #[error(transparent)] + ApiDiagnostic_Delete(#[from] api_diagnostic::delete::Error), + #[error(transparent)] + ApiDiagnostic_GetEntityTag(#[from] api_diagnostic::get_entity_tag::Error), + #[error(transparent)] + ApiIssue_ListByService(#[from] api_issue::list_by_service::Error), + #[error(transparent)] + ApiIssue_Get(#[from] api_issue::get::Error), + #[error(transparent)] + ApiIssue_CreateOrUpdate(#[from] api_issue::create_or_update::Error), + #[error(transparent)] + ApiIssue_Update(#[from] api_issue::update::Error), + #[error(transparent)] + ApiIssue_Delete(#[from] api_issue::delete::Error), + #[error(transparent)] + ApiIssue_GetEntityTag(#[from] api_issue::get_entity_tag::Error), + #[error(transparent)] + ApiIssueComment_ListByService(#[from] api_issue_comment::list_by_service::Error), + #[error(transparent)] + ApiIssueComment_Get(#[from] api_issue_comment::get::Error), + #[error(transparent)] + ApiIssueComment_CreateOrUpdate(#[from] api_issue_comment::create_or_update::Error), + #[error(transparent)] + ApiIssueComment_Delete(#[from] api_issue_comment::delete::Error), + #[error(transparent)] + ApiIssueComment_GetEntityTag(#[from] api_issue_comment::get_entity_tag::Error), + #[error(transparent)] + ApiIssueAttachment_ListByService(#[from] api_issue_attachment::list_by_service::Error), + #[error(transparent)] + ApiIssueAttachment_Get(#[from] api_issue_attachment::get::Error), + #[error(transparent)] + ApiIssueAttachment_CreateOrUpdate(#[from] api_issue_attachment::create_or_update::Error), + #[error(transparent)] + ApiIssueAttachment_Delete(#[from] api_issue_attachment::delete::Error), + #[error(transparent)] + ApiIssueAttachment_GetEntityTag(#[from] api_issue_attachment::get_entity_tag::Error), + #[error(transparent)] + ApiTagDescription_ListByService(#[from] api_tag_description::list_by_service::Error), + #[error(transparent)] + ApiTagDescription_Get(#[from] api_tag_description::get::Error), + #[error(transparent)] + ApiTagDescription_CreateOrUpdate(#[from] api_tag_description::create_or_update::Error), + #[error(transparent)] + ApiTagDescription_Delete(#[from] api_tag_description::delete::Error), + #[error(transparent)] + ApiTagDescription_GetEntityTag(#[from] api_tag_description::get_entity_tag::Error), + #[error(transparent)] + Tag_ListByApi(#[from] tag::list_by_api::Error), + #[error(transparent)] + Tag_GetByApi(#[from] tag::get_by_api::Error), + #[error(transparent)] + Tag_AssignToApi(#[from] tag::assign_to_api::Error), + #[error(transparent)] + Tag_DetachFromApi(#[from] tag::detach_from_api::Error), + #[error(transparent)] + Tag_GetEntityStateByApi(#[from] tag::get_entity_state_by_api::Error), + #[error(transparent)] + Operation_ListByTags(#[from] operation::list_by_tags::Error), + #[error(transparent)] Api_ListByTags(#[from] api::list_by_tags::Error), #[error(transparent)] ApiVersionSet_ListByService(#[from] api_version_set::list_by_service::Error), @@ -887,6 +1072,109 @@ pub mod api { use super::models; 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, + tags: None, + expand_api_version_set: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + delete_revisions: None, + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } pub fn list_by_tags( &self, resource_group_name: impl Into, @@ -905,7 +1193,7 @@ pub mod api { } } } - pub mod list_by_tags { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -938,7 +1226,8 @@ pub mod api { pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, - pub(crate) include_not_tagged_apis: Option, + pub(crate) tags: Option, + pub(crate) expand_api_version_set: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -953,14 +1242,18 @@ pub mod api { self.skip = Some(skip); self } - pub fn include_not_tagged_apis(mut self, include_not_tagged_apis: bool) -> Self { - self.include_not_tagged_apis = Some(include_not_tagged_apis); + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.into()); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn expand_api_version_set(mut self, expand_api_version_set: bool) -> Self { + self.expand_api_version_set = Some(expand_api_version_set); + 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/{}/apisByTags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -985,9 +1278,12 @@ pub mod api { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } - if let Some(include_not_tagged_apis) = &self.include_not_tagged_apis { + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } + if let Some(expand_api_version_set) = &self.expand_api_version_set { url.query_pairs_mut() - .append_pair("includeNotTaggedApis", &include_not_tagged_apis.to_string()); + .append_pair("expandApiVersionSet", &expand_api_version_set.to_string()); } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); @@ -997,7 +1293,7 @@ pub mod api { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagResourceCollection = + let rsp_value: models::ApiCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1015,255 +1311,48 @@ pub mod api { } } } -} -pub mod api_version_set { - use super::models; - 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, - version_set_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(), - version_set_id: version_set_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - version_set_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(), - version_set_id: version_set_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - version_set_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - version_set_id: version_set_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - version_set_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(), - version_set_id: version_set_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, - version_set_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(), - version_set_id: version_set_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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/{}/apiVersionSets", - 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", "2021-01-01-preview"); - 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::ApiVersionSetCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_id: String, + pub(crate) api_id: String, 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.ApiManagement/service/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1283,7 +1372,7 @@ pub mod api_version_set { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiVersionSetContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1305,8 +1394,9 @@ pub mod api_version_set { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::ApiVersionSetContract), - Ok200(models::ApiVersionSetContract), + Created201(models::ApiContract), + Accepted202, + Ok200(models::ApiContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1335,8 +1425,8 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, - pub(crate) parameters: models::ApiVersionSetContract, + pub(crate) api_id: String, + pub(crate) parameters: models::ApiCreateOrUpdateParameter, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -1348,12 +1438,12 @@ pub mod api_version_set { 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/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1377,13 +1467,14 @@ pub mod api_version_set { 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::ApiVersionSetContract = + let rsp_value: models::ApiContract = 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), http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiVersionSetContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -1430,21 +1521,21 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, - pub(crate) parameters: models::ApiVersionSetUpdateParameters, + pub(crate) api_id: String, + pub(crate) parameters: models::ApiUpdateContract, pub(crate) if_match: String, 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.ApiManagement/service/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1466,7 +1557,7 @@ pub mod api_version_set { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiVersionSetContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1518,20 +1609,25 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, + pub(crate) api_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) delete_revisions: Option, } impl Builder { + pub fn delete_revisions(mut self, delete_revisions: bool) -> Self { + self.delete_revisions = Some(delete_revisions); + 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/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1543,6 +1639,9 @@ pub mod api_version_set { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + if let Some(delete_revisions) = &self.delete_revisions { + url.query_pairs_mut().append_pair("deleteRevisions", &delete_revisions.to_string()); + } 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()); @@ -1595,19 +1694,19 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, + pub(crate) api_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/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1640,128 +1739,7 @@ pub mod api_version_set { } } } -} -pub mod authorization_server { - use super::models; - 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, - authsid: 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(), - authsid: authsid.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: 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(), - authsid: authsid.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - authsid: authsid.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: 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(), - authsid: authsid.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, - authsid: 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(), - authsid: authsid.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_secrets( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: impl Into, - subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - authsid: authsid.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod list_by_tags { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1794,6 +1772,7 @@ pub mod authorization_server { pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, + pub(crate) include_not_tagged_apis: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -1808,12 +1787,14 @@ pub mod authorization_server { self.skip = Some(skip); self } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn include_not_tagged_apis(mut self, include_not_tagged_apis: bool) -> Self { + self.include_not_tagged_apis = Some(include_not_tagged_apis); + 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/{}/authorizationServers", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apisByTags", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -1838,6 +1819,10 @@ pub mod authorization_server { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } + if let Some(include_not_tagged_apis) = &self.include_not_tagged_apis { + url.query_pairs_mut() + .append_pair("includeNotTaggedApis", &include_not_tagged_apis.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)?; @@ -1846,7 +1831,7 @@ pub mod authorization_server { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerCollection = + let rsp_value: models::TagResourceCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1864,7 +1849,31 @@ pub mod authorization_server { } } } - pub mod get { +} +pub mod api_revision { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1893,21 +1902,34 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, + pub(crate) api_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/revisions", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1919,6 +1941,15 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + 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)?; @@ -1927,7 +1958,7 @@ pub mod authorization_server { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerContract = + let rsp_value: models::ApiRevisionCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1945,63 +1976,185 @@ pub mod authorization_server { } } } - pub mod create_or_update { - use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::AuthorizationServerContract), - Ok200(models::AuthorizationServerContract), +} +pub mod api_release { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } } - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_id.into(), + subscription_id: subscription_id.into(), + } } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + release_id: release_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_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, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: String, - pub(crate) parameters: models::AuthorizationServerContract, + pub(crate) api_id: String, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + 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> { + 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2009,27 +2162,26 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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); + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerContract = - 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::AuthorizationServerContract = + let rsp_value: models::ApiReleaseCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -2045,7 +2197,7 @@ pub mod authorization_server { } } } - pub mod update { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2074,27 +2226,25 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, - pub(crate) parameters: models::AuthorizationServerUpdateContract, - pub(crate) if_match: String, + pub(crate) api_id: String, + pub(crate) release_id: String, 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.ApiManagement/service/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2102,9 +2252,7 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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.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)?; @@ -2112,7 +2260,7 @@ pub mod authorization_server { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerContract = + let rsp_value: models::ApiReleaseContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2130,12 +2278,12 @@ pub mod authorization_server { } } } - pub mod delete { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200, - NoContent204, + Created201(models::ApiReleaseContract), + Ok200(models::ApiReleaseContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2164,24 +2312,31 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, - pub(crate) if_match: String, + pub(crate) api_id: String, + pub(crate) release_id: String, + pub(crate) parameters: models::ApiReleaseContract, 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2189,15 +2344,28 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - req_builder = req_builder.header("If-Match", &self.if_match); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiReleaseContract = + 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::ApiReleaseContract = + 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 = @@ -2212,7 +2380,7 @@ pub mod authorization_server { } } } - pub mod get_entity_tag { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2241,23 +2409,27 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, + pub(crate) api_id: String, + pub(crate) release_id: String, + pub(crate) parameters: models::ApiReleaseContract, + pub(crate) if_match: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2265,13 +2437,20 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiReleaseContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -2286,8 +2465,13 @@ pub mod authorization_server { } } } - pub mod list_secrets { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -2315,18 +2499,26 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, + pub(crate) api_id: String, + pub(crate) release_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> { + 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/{}/authorizationServers/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . authsid) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2334,19 +2526,15 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); 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::AuthorizationServerSecretsContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -2361,39 +2549,120 @@ pub mod authorization_server { } } } -} -pub mod backend { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_service( - &self, + pub mod get_entity_tag { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) release_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/{}/apis/{}/releases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.release_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_operation { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, resource_group_name: impl Into, service_name: impl Into, + api_id: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> list_by_api::Builder { + list_by_api::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, + tags: None, } } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, + api_id: impl Into, + operation_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(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), } } @@ -2401,15 +2670,17 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_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(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -2419,8 +2690,9 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -2428,7 +2700,8 @@ pub mod backend { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), @@ -2438,7 +2711,8 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, + api_id: impl Into, + operation_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -2446,7 +2720,8 @@ pub mod backend { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -2455,35 +2730,21 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, + api_id: impl Into, + operation_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(), - backend_id: backend_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn reconnect( - &self, - resource_group_name: impl Into, - service_name: impl Into, - backend_id: impl Into, - subscription_id: impl Into, - ) -> reconnect::Builder { - reconnect::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), - parameters: None, } } } - pub mod list_by_service { + pub mod list_by_api { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2512,10 +2773,12 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) api_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, + pub(crate) tags: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -2530,14 +2793,19 @@ pub mod backend { self.skip = Some(skip); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.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/{}/backends", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2558,6 +2826,9 @@ pub mod backend { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -2566,7 +2837,7 @@ pub mod backend { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackendCollection = + let rsp_value: models::OperationCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2613,19 +2884,21 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, 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.ApiManagement/service/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2645,7 +2918,7 @@ pub mod backend { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackendContract = + let rsp_value: models::OperationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2667,8 +2940,8 @@ pub mod backend { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::BackendContract), - Ok200(models::BackendContract), + Created201(models::OperationContract), + Ok200(models::OperationContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2697,8 +2970,9 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, - pub(crate) parameters: models::BackendContract, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) parameters: models::OperationContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -2710,12 +2984,13 @@ pub mod backend { 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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2739,13 +3014,13 @@ pub mod backend { 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::BackendContract = + let rsp_value: models::OperationContract = 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::BackendContract = + let rsp_value: models::OperationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -2792,21 +3067,23 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, - pub(crate) parameters: models::BackendUpdateParameters, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) parameters: models::OperationUpdateContract, pub(crate) if_match: String, 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.ApiManagement/service/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2828,7 +3105,7 @@ pub mod backend { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackendContract = + let rsp_value: models::OperationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2880,7 +3157,8 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -2888,12 +3166,13 @@ pub mod backend { 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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2957,19 +3236,21 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, + pub(crate) api_id: String, + pub(crate) operation_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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -3002,167 +3283,77 @@ pub mod backend { } } } - pub mod reconnect { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) backend_id: 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<(), Error>> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}/reconnect", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.backend_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", "2021-01-01-preview"); - 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::ACCEPTED => 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 cache { +pub mod api_operation_policy { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_service( + pub fn list_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> list_by_operation::Builder { + list_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), - top: None, - skip: None, } } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_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(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), + format: None, } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_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(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, } } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - cache_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - cache_id: cache_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -3170,7 +3361,9 @@ pub mod cache { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -3179,19 +3372,23 @@ pub mod cache { &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_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(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_service { + pub mod list_by_operation { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3220,27 +3417,21 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, pub(crate) subscription_id: String, - pub(crate) top: Option, - pub(crate) skip: Option, } impl Builder { - 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> { + 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/{}/caches", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -3252,12 +3443,6 @@ pub mod cache { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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)?; @@ -3266,7 +3451,7 @@ pub mod cache { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CacheCollection = + let rsp_value: models::PolicyCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -3313,20 +3498,20 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_id: String, pub(crate) subscription_id: String, + pub(crate) format: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3337,6 +3522,9 @@ pub mod cache { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -3345,7 +3533,7 @@ pub mod cache { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CacheContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -3367,8 +3555,8 @@ pub mod cache { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::CacheContract), - Ok200(models::CacheContract), + Created201(models::PolicyContract), + Ok200(models::PolicyContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3397,8 +3585,10 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, - pub(crate) parameters: models::CacheContract, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -3409,14 +3599,7 @@ pub mod cache { } 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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3439,13 +3622,13 @@ pub mod cache { 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::CacheContract = + let rsp_value: models::PolicyContract = 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::CacheContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -3463,89 +3646,6 @@ pub mod cache { } } } - pub mod update { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) cache_id: String, - pub(crate) parameters: models::CacheUpdateParameters, - 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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_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", "2021-01-01-preview"); - 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.header("If-Match", &self.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::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CacheContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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; #[derive(Debug)] @@ -3580,21 +3680,16 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3657,20 +3752,15 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3703,110 +3793,8351 @@ pub mod cache { } } } -pub mod certificate { +pub mod tag { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_service( + pub fn list_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> list_by_operation::Builder { + list_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, - is_key_vault_refresh_failed: None, } } - pub fn get( + pub fn get_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> get::Builder { - get::Builder { + ) -> get_by_operation::Builder { + get_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), } } - pub fn create_or_update( + pub fn assign_to_operation( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> create_or_update::Builder { - create_or_update::Builder { + ) -> assign_to_operation::Builder { + assign_to_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), - parameters: parameters.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), - if_match: None, } } - pub fn delete( + pub fn detach_from_operation( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, - if_match: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> delete::Builder { - delete::Builder { + ) -> detach_from_operation::Builder { + detach_from_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), - if_match: if_match.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), } } - pub fn get_entity_tag( + pub fn get_entity_state_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> get_entity_tag::Builder { - get_entity_tag::Builder { + ) -> get_entity_state_by_operation::Builder { + get_entity_state_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), } } - pub fn refresh_secret( + pub fn list_by_api( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, + api_id: impl Into, subscription_id: impl Into, - ) -> refresh_secret::Builder { - refresh_secret::Builder { + ) -> list_by_api::Builder { + list_by_api::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_by_api::Builder { + get_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn assign_to_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> assign_to_api::Builder { + assign_to_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn detach_from_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> detach_from_api::Builder { + detach_from_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state_by_api::Builder { + get_entity_state_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list_by_product::Builder { + list_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_by_product::Builder { + get_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn assign_to_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> assign_to_product::Builder { + assign_to_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn detach_from_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> detach_from_product::Builder { + detach_from_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state_by_product::Builder { + get_entity_state_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + 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, + scope: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_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(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_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(), + tag_id: tag_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + tag_id: tag_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_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(), + tag_id: tag_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state::Builder { + get_entity_state::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: 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/{}/apis/{}/operations/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2021-01-01-preview"); + 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::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 assign_to_operation { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TagContract = + 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::TagContract = + 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 detach_from_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_state_by_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2021-01-01-preview"); + 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::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 assign_to_api { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TagContract = + 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::TagContract = + 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 detach_from_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_state_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_by_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: 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/{}/products/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_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", "2021-01-01-preview"); + 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::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 assign_to_product { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TagContract = + 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::TagContract = + 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 detach_from_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_state_by_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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, + pub(crate) scope: 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 scope(mut self, scope: impl Into) -> Self { + self.scope = Some(scope.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/{}/tags", + 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", "2021-01-01-preview"); + 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()); + } + if let Some(scope) = &self.scope { + url.query_pairs_mut().append_pair("scope", scope); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_id: String, + pub(crate) parameters: models::TagCreateUpdateParameters, + 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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2021-01-01-preview"); + 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::TagContract = + 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::TagContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_id: String, + pub(crate) parameters: models::TagCreateUpdateParameters, + 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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2021-01-01-preview"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2021-01-01-preview"); + 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_state { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_product { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_apis( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_apis::Builder { + list_by_apis::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list_by_apis { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/products", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2021-01-01-preview"); + 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::ProductCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 api_policy { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + format: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_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, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_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, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_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/{}/apis/{}/policies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match 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)?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_id: String, + pub(crate) subscription_id: String, + pub(crate) format: Option, + } + impl Builder { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2021-01-01-preview"); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, + 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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2021-01-01-preview"); + 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::PolicyContract = + 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::PolicyContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2021-01-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_schema { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.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, + api_id: 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(), + api_id: api_id.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, + api_id: 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(), + api_id: api_id.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, + api_id: 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(), + api_id: api_id.into(), + schema_id: schema_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + force: None, + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + schema_id: schema_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/schemas", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2021-01-01-preview"); + 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::SchemaCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SchemaContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Accepted202, + Created201(models::SchemaContract), + Ok200(models::SchemaContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) schema_id: String, + pub(crate) parameters: models::SchemaContract, + 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2021-01-01-preview"); + 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::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SchemaContract = + 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::SchemaContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) schema_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + pub(crate) force: Option, + } + impl Builder { + pub fn force(mut self, force: bool) -> Self { + self.force = Some(force); + 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2021-01-01-preview"); + if let Some(force) = &self.force { + url.query_pairs_mut().append_pair("force", &force.to_string()); + } + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_diagnostic { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.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, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_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, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/diagnostics", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2021-01-01-preview"); + 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::DiagnosticCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::DiagnosticContract), + Ok200(models::DiagnosticContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + 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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2021-01-01-preview"); + 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::DiagnosticContract = + 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::DiagnosticContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + 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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2021-01-01-preview"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2021-01-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_issue { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + expand_comments_attachments: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + expand_comments_attachments: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + issue_id: issue_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_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, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) expand_comments_attachments: 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 expand_comments_attachments(mut self, expand_comments_attachments: bool) -> Self { + self.expand_comments_attachments = Some(expand_comments_attachments); + 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/{}/apis/{}/issues", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2021-01-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(expand_comments_attachments) = &self.expand_comments_attachments { + url.query_pairs_mut() + .append_pair("expandCommentsAttachments", &expand_comments_attachments.to_string()); + } + 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::IssueCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) subscription_id: String, + pub(crate) expand_comments_attachments: Option, + } + impl Builder { + pub fn expand_comments_attachments(mut self, expand_comments_attachments: bool) -> Self { + self.expand_comments_attachments = Some(expand_comments_attachments); + 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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2021-01-01-preview"); + if let Some(expand_comments_attachments) = &self.expand_comments_attachments { + url.query_pairs_mut() + .append_pair("expandCommentsAttachments", &expand_comments_attachments.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::IssueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueContract), + Ok200(models::IssueContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) parameters: models::IssueContract, + 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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2021-01-01-preview"); + 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::IssueContract = + 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::IssueContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) parameters: models::IssueUpdateContract, + 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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2021-01-01-preview"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2021-01-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_issue_comment { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: 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(), + api_id: api_id.into(), + issue_id: issue_id.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, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_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, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_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, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: 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/{}/apis/{}/issues/{}/comments", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2021-01-01-preview"); + 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::IssueCommentCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueCommentContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueCommentContract), + Ok200(models::IssueCommentContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_id: String, + pub(crate) parameters: models::IssueCommentContract, + 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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2021-01-01-preview"); + 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::IssueCommentContract = + 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::IssueCommentContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2021-01-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_issue_attachment { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: 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(), + api_id: api_id.into(), + issue_id: issue_id.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, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_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, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_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, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: 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/{}/apis/{}/issues/{}/attachments", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2021-01-01-preview"); + 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::IssueAttachmentCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueAttachmentContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueAttachmentContract), + Ok200(models::IssueAttachmentContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_id: String, + pub(crate) parameters: models::IssueAttachmentContract, + 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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2021-01-01-preview"); + 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::IssueAttachmentContract = + 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::IssueAttachmentContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2021-01-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_tag_description { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.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, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_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, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_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, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/tagDescriptions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2021-01-01-preview"); + 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::TagDescriptionCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagDescriptionContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::TagDescriptionContract), + Ok200(models::TagDescriptionContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_id: String, + pub(crate) parameters: models::TagDescriptionCreateParameters, + 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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2021-01-01-preview"); + 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::TagDescriptionContract = + 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::TagDescriptionContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2021-01-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 operation { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_tags( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_tags::Builder { + list_by_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + include_not_tagged_operations: None, + } + } + } + pub mod list_by_tags { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) include_not_tagged_operations: 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 include_not_tagged_operations(mut self, include_not_tagged_operations: bool) -> Self { + self.include_not_tagged_operations = Some(include_not_tagged_operations); + 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/{}/apis/{}/operationsByTags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2021-01-01-preview"); + 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()); + } + if let Some(include_not_tagged_operations) = &self.include_not_tagged_operations { + url.query_pairs_mut() + .append_pair("includeNotTaggedOperations", &include_not_tagged_operations.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::TagResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 api_version_set { + use super::models; + 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, + version_set_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(), + version_set_id: version_set_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_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(), + version_set_id: version_set_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + version_set_id: version_set_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_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(), + version_set_id: version_set_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, + version_set_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(), + version_set_id: version_set_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/apiVersionSets", + 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", "2021-01-01-preview"); + 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::ApiVersionSetCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiVersionSetContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::ApiVersionSetContract), + Ok200(models::ApiVersionSetContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_id: String, + pub(crate) parameters: models::ApiVersionSetContract, + 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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2021-01-01-preview"); + 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::ApiVersionSetContract = + 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::ApiVersionSetContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_id: String, + pub(crate) parameters: models::ApiVersionSetUpdateParameters, + 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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2021-01-01-preview"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiVersionSetContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2021-01-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 authorization_server { + use super::models; + 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, + authsid: 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(), + authsid: authsid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: 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(), + authsid: authsid.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + authsid: authsid.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: 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(), + authsid: authsid.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, + authsid: 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(), + authsid: authsid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + authsid: authsid.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/authorizationServers", + 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", "2021-01-01-preview"); + 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::AuthorizationServerCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationServerContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::AuthorizationServerContract), + Ok200(models::AuthorizationServerContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: String, + pub(crate) parameters: models::AuthorizationServerContract, + 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2021-01-01-preview"); + 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::AuthorizationServerContract = + 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::AuthorizationServerContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: String, + pub(crate) parameters: models::AuthorizationServerUpdateContract, + 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2021-01-01-preview"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationServerContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2021-01-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_secrets { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . authsid) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + 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::AuthorizationServerSecretsContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 backend { + use super::models; + 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, + backend_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(), + backend_id: backend_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_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(), + backend_id: backend_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + backend_id: backend_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_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(), + backend_id: backend_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, + backend_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(), + backend_id: backend_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn reconnect( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_id: impl Into, + subscription_id: impl Into, + ) -> reconnect::Builder { + reconnect::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + backend_id: backend_id.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/backends", + 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", "2021-01-01-preview"); + 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::BackendCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) backend_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/{}/backends/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.backend_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackendContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::BackendContract), + Ok200(models::BackendContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) backend_id: String, + pub(crate) parameters: models::BackendContract, + 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/{}/backends/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.backend_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", "2021-01-01-preview"); + 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::BackendContract = + 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::BackendContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) backend_id: String, + pub(crate) parameters: models::BackendUpdateParameters, + 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/{}/backends/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.backend_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", "2021-01-01-preview"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackendContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_service { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -3834,41 +12165,24 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) backend_id: String, + pub(crate) if_match: String, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, - pub(crate) is_key_vault_refresh_failed: 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 is_key_vault_refresh_failed(mut self, is_key_vault_refresh_failed: bool) -> Self { - self.is_key_vault_refresh_failed = Some(is_key_vault_refresh_failed); - self - } - 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.ApiManagement/service/{}/certificates", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.backend_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -3876,31 +12190,15 @@ pub mod certificate { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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()); - } - if let Some(is_key_vault_refresh_failed) = &self.is_key_vault_refresh_failed { - url.query_pairs_mut() - .append_pair("isKeyVaultRefreshFailed", &is_key_vault_refresh_failed.to_string()); - } + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CertificateCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -3915,7 +12213,7 @@ pub mod certificate { } } } - pub mod get { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3944,23 +12242,23 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, + pub(crate) backend_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.certificate_id + &self.backend_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -3974,12 +12272,7 @@ pub mod certificate { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CertificateContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -3994,13 +12287,8 @@ pub mod certificate { } } } - pub mod create_or_update { + pub mod reconnect { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::CertificateContract), - Ok200(models::CertificateContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -4028,29 +12316,28 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, - pub(crate) parameters: models::CertificateCreateOrUpdateParameters, + pub(crate) backend_id: String, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) parameters: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + 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> { + 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/{}/certificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}/reconnect", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.certificate_id + &self.backend_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4058,28 +12345,18 @@ pub mod certificate { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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); - } + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CertificateContract = - 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::CertificateContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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::ErrorResponse = @@ -4094,89 +12371,112 @@ pub mod certificate { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, +} +pub mod cache { + use super::models; + 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(), + top: None, + skip: None, + } } - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_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(), + cache_id: cache_id.into(), + subscription_id: subscription_id.into(), + } } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) certificate_id: String, - pub(crate) if_match: String, - pub(crate) subscription_id: String, + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_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(), + cache_id: cache_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + cache_id: cache_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_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(), + cache_id: cache_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } } - impl Builder { - 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/{}/certificates/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.certificate_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", "2021-01-01-preview"); - 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 fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_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(), + cache_id: cache_id.into(), + subscription_id: subscription_id.into(), } } } - pub mod get_entity_tag { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4205,23 +12505,31 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/certificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.certificate_id + &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::HEAD); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4229,13 +12537,24 @@ pub mod certificate { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + 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 => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CacheCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -4250,7 +12569,7 @@ pub mod certificate { } } } - pub mod refresh_secret { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4279,23 +12598,23 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, + pub(crate) cache_id: String, 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.ApiManagement/service/{}/certificates/{}/refreshSecret", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.certificate_id + &self.cache_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4304,7 +12623,6 @@ pub mod certificate { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); 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)?; @@ -4312,7 +12630,7 @@ pub mod certificate { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CertificateContract = + let rsp_value: models::CacheContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -4330,75 +12648,13 @@ pub mod certificate { } } } -} -pub mod content_type { - use super::models; - 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(), - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - content_type_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(), - content_type_id: content_type_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - content_type_id: 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(), - content_type_id: content_type_id.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - content_type_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(), - content_type_id: content_type_id.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::CacheContract), + Ok200(models::CacheContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -4426,21 +12682,29 @@ pub mod content_type { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) cache_id: String, + pub(crate) parameters: models::CacheContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/contentTypes", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.cache_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4448,17 +12712,27 @@ pub mod content_type { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::CacheContract = + 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::ContentTypeCollection = + let rsp_value: models::CacheContract = 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)?; @@ -4474,7 +12748,7 @@ pub mod content_type { } } } - pub mod get { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4503,23 +12777,25 @@ pub mod content_type { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, + pub(crate) cache_id: String, + pub(crate) parameters: models::CacheUpdateParameters, + pub(crate) if_match: String, 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.ApiManagement/service/{}/contentTypes/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.content_type_id + &self.cache_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4527,7 +12803,9 @@ pub mod content_type { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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)?; @@ -4535,7 +12813,7 @@ pub mod content_type { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ContentTypeContract = + let rsp_value: models::CacheContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -4553,12 +12831,12 @@ pub mod content_type { } } } - pub mod create_or_update { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::ContentTypeContract), - Ok200(models::ContentTypeContract), + Ok200, + NoContent204, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4587,28 +12865,24 @@ pub mod content_type { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, + pub(crate) cache_id: String, + pub(crate) if_match: String, 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/{}/contentTypes/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.content_type_id + &self.cache_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4616,27 +12890,15 @@ pub mod content_type { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - if let Some(if_match) = &self.if_match { - req_builder = req_builder.header("If-Match", if_match); - } + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ContentTypeContract = - 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::ContentTypeContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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 = @@ -4651,13 +12913,8 @@ pub mod content_type { } } } - pub mod delete { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -4685,24 +12942,23 @@ pub mod content_type { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) if_match: String, + pub(crate) cache_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.content_type_id + &self.cache_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4710,15 +12966,13 @@ pub mod content_type { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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), + 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 = @@ -4734,7 +12988,7 @@ pub mod content_type { } } } -pub mod content_item { +pub mod certificate { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -4742,31 +12996,31 @@ pub mod content_item { &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: 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(), - content_type_id: content_type_id.into(), subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + is_key_vault_refresh_failed: None, } } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: impl Into, - content_item_id: impl Into, + certificate_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(), - content_type_id: content_type_id.into(), - content_item_id: content_item_id.into(), + certificate_id: certificate_id.into(), subscription_id: subscription_id.into(), } } @@ -4774,16 +13028,16 @@ pub mod content_item { &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: impl Into, - content_item_id: impl Into, + certificate_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(), - content_type_id: content_type_id.into(), - content_item_id: content_item_id.into(), + certificate_id: certificate_id.into(), + parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, } @@ -4792,8 +13046,7 @@ pub mod content_item { &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: impl Into, - content_item_id: impl Into, + certificate_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -4801,8 +13054,7 @@ pub mod content_item { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - content_type_id: content_type_id.into(), - content_item_id: content_item_id.into(), + certificate_id: certificate_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -4811,16 +13063,29 @@ pub mod content_item { &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: impl Into, - content_item_id: impl Into, + certificate_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(), - content_type_id: content_type_id.into(), - content_item_id: content_item_id.into(), + certificate_id: certificate_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn refresh_secret( + &self, + resource_group_name: impl Into, + service_name: impl Into, + certificate_id: impl Into, + subscription_id: impl Into, + ) -> refresh_secret::Builder { + refresh_secret::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + certificate_id: certificate_id.into(), subscription_id: subscription_id.into(), } } @@ -4854,19 +13119,37 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) is_key_vault_refresh_failed: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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 is_key_vault_refresh_failed(mut self, is_key_vault_refresh_failed: bool) -> Self { + self.is_key_vault_refresh_failed = Some(is_key_vault_refresh_failed); + 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/{}/contentTypes/{}/contentItems", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.content_type_id + &self.service_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -4878,6 +13161,19 @@ pub mod content_item { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + 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()); + } + if let Some(is_key_vault_refresh_failed) = &self.is_key_vault_refresh_failed { + url.query_pairs_mut() + .append_pair("isKeyVaultRefreshFailed", &is_key_vault_refresh_failed.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)?; @@ -4886,7 +13182,7 @@ pub mod content_item { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ContentItemCollection = + let rsp_value: models::CertificateCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -4933,14 +13229,20 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) content_item_id: String, + pub(crate) certificate_id: String, 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.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_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); @@ -4959,7 +13261,7 @@ pub mod content_item { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ContentItemContract = + let rsp_value: models::CertificateContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -4981,8 +13283,8 @@ pub mod content_item { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::ContentItemContract), - Ok200(models::ContentItemContract), + Created201(models::CertificateContract), + Ok200(models::CertificateContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5011,8 +13313,8 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) content_item_id: String, + pub(crate) certificate_id: String, + pub(crate) parameters: models::CertificateCreateOrUpdateParameters, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -5023,7 +13325,14 @@ pub mod content_item { } 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/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_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); @@ -5034,10 +13343,11 @@ pub mod content_item { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -5045,13 +13355,13 @@ pub mod content_item { 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::ContentItemContract = + let rsp_value: models::CertificateContract = 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::ContentItemContract = + let rsp_value: models::CertificateContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -5103,15 +13413,21 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) content_item_id: String, + pub(crate) certificate_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/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_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); @@ -5129,8 +13445,82 @@ pub mod content_item { let rsp = 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::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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) certificate_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/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 = @@ -5145,7 +13535,7 @@ pub mod content_item { } } } - pub mod get_entity_tag { + pub mod refresh_secret { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5174,17 +13564,23 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) content_item_id: String, + pub(crate) certificate_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}/refreshSecret", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5193,12 +13589,18 @@ pub mod content_item { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CertificateContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -5214,44 +13616,73 @@ pub mod content_item { } } } -pub mod deleted_services { +pub mod content_type { use super::models; 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 { + 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(), } } - pub fn get_by_name( + pub fn get( &self, + resource_group_name: impl Into, service_name: impl Into, + content_type_id: impl Into, subscription_id: impl Into, - location: impl Into, - ) -> get_by_name::Builder { - get_by_name::Builder { + ) -> get::Builder { + get::Builder { client: self.0.clone(), + resource_group_name: resource_group_name.into(), service_name: service_name.into(), + content_type_id: content_type_id.into(), subscription_id: subscription_id.into(), - location: location.into(), } } - pub fn purge( + pub fn create_or_update( &self, + resource_group_name: impl Into, service_name: impl Into, + content_type_id: impl Into, subscription_id: impl Into, - location: impl Into, - ) -> purge::Builder { - purge::Builder { + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + content_type_id: content_type_id.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + content_type_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(), + content_type_id: content_type_id.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), - location: location.into(), } } } - pub mod list_by_subscription { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5278,15 +13709,19 @@ pub mod deleted_services { #[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, } 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.ApiManagement/deletedservices", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes", self.client.endpoint(), - &self.subscription_id + &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(); @@ -5306,7 +13741,7 @@ pub mod deleted_services { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DeletedServicesCollection = + let rsp_value: models::ContentTypeCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -5324,7 +13759,7 @@ pub mod deleted_services { } } } - pub mod get_by_name { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5351,19 +13786,21 @@ pub mod deleted_services { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) content_type_id: String, pub(crate) subscription_id: String, - pub(crate) location: 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.ApiManagement/locations/{}/deletedservices/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", self.client.endpoint(), &self.subscription_id, - &self.location, - &self.service_name + &self.resource_group_name, + &self.service_name, + &self.content_type_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -5383,7 +13820,7 @@ pub mod deleted_services { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DeletedServiceContract = + let rsp_value: models::ContentTypeContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -5401,13 +13838,12 @@ pub mod deleted_services { } } } - pub mod purge { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200, - Accepted202(models::DeletedServiceContract), - NoContent204, + Created201(models::ContentTypeContract), + Ok200(models::ContentTypeContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5434,23 +13870,30 @@ pub mod deleted_services { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) content_type_id: String, pub(crate) subscription_id: String, - pub(crate) location: 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/{}/providers/Microsoft.ApiManagement/locations/{}/deletedservices/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", self.client.endpoint(), &self.subscription_id, - &self.location, - &self.service_name + &self.resource_group_name, + &self.service_name, + &self.content_type_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5458,133 +13901,48 @@ pub mod deleted_services { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = 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::DeletedServiceContract = - 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, - }) - } + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); } - }) - } - } - } -} -pub mod api_management_operations { - use super::models; - 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; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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.ApiManagement/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", "2021-01-01-preview"); let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { + http::StatusCode::CREATED => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OperationListResult = + let rsp_value: models::ContentTypeContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + Ok(Response::Created201(rsp_value)) } - status_code => { + http::StatusCode::OK => { 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 api_management_service_skus { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Gets available SKUs for API Management service"] - pub fn list_available_service_skus( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> list_available_service_skus::Builder { - list_available_service_skus::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - subscription_id: subscription_id.into(), + let rsp_value: models::ContentTypeContract = + 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 list_available_service_skus { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -5612,21 +13970,24 @@ pub mod api_management_service_skus { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) content_type_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> { + 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/{}/skus", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.content_type_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5634,18 +13995,15 @@ pub mod api_management_service_skus { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ResourceSkuResults = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -5661,37 +14019,22 @@ pub mod api_management_service_skus { } } } -pub mod api_management_service { +pub mod content_item { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn restore( - &self, - resource_group_name: impl Into, - service_name: impl Into, - parameters: impl Into, - subscription_id: impl Into, - ) -> restore::Builder { - restore::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn backup( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + content_type_id: impl Into, subscription_id: impl Into, - ) -> backup::Builder { - backup::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - parameters: parameters.into(), + content_type_id: content_type_id.into(), subscription_id: subscription_id.into(), } } @@ -5699,12 +14042,16 @@ pub mod api_management_service { &self, resource_group_name: impl Into, service_name: impl Into, + content_type_id: impl Into, + content_item_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(), + content_type_id: content_type_id.into(), + content_item_id: content_item_id.into(), subscription_id: subscription_id.into(), } } @@ -5712,114 +14059,59 @@ pub mod api_management_service { &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + content_type_id: impl Into, + content_item_id: 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(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_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(), - service_name: service_name.into(), - parameters: parameters.into(), + content_type_id: content_type_id.into(), + content_item_id: content_item_id.into(), subscription_id: subscription_id.into(), + if_match: None, } } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, + content_type_id: impl Into, + content_item_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(), + content_type_id: content_type_id.into(), + content_item_id: content_item_id.into(), + if_match: if_match.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 fn get_sso_token( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> get_sso_token::Builder { - get_sso_token::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - subscription_id: subscription_id.into(), - } - } - 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 get_domain_ownership_identifier(&self, subscription_id: impl Into) -> get_domain_ownership_identifier::Builder { - get_domain_ownership_identifier::Builder { - client: self.0.clone(), - subscription_id: subscription_id.into(), - } - } - pub fn apply_network_configuration_updates( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, + content_type_id: impl Into, + content_item_id: impl Into, subscription_id: impl Into, - ) -> apply_network_configuration_updates::Builder { - apply_network_configuration_updates::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + content_type_id: content_type_id.into(), + content_item_id: content_item_id.into(), subscription_id: subscription_id.into(), - parameters: None, } } } - pub mod restore { + pub mod list_by_service { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -5847,22 +14139,23 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, + pub(crate) content_type_id: String, 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.ApiManagement/service/{}/restore", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.content_type_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5870,8 +14163,7 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -5879,11 +14171,83 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = + let rsp_value: models::ContentItemCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) content_type_id: String, + pub(crate) content_item_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/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContentItemContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(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 = @@ -5898,12 +14262,12 @@ pub mod api_management_service { } } } - pub mod backup { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, + Created201(models::ContentItemContract), + Ok200(models::ContentItemContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5932,22 +14296,22 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, + pub(crate) content_type_id: String, + pub(crate) content_item_id: String, 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/{}/backup", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5955,20 +14319,27 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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); + } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ContentItemContract = + 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::ApiManagementServiceResource = + let rsp_value: models::ContentItemContract = 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 = @@ -5983,8 +14354,13 @@ pub mod api_management_service { } } } - pub mod get { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6012,23 +14388,18 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) content_type_id: String, + pub(crate) content_item_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> { + 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/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6036,18 +14407,15 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -6062,14 +14430,8 @@ pub mod api_management_service { } } } - pub mod create_or_update { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ApiManagementServiceResource), - Created201(models::ApiManagementServiceResource), - Accepted202, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6097,22 +14459,17 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceResource, + pub(crate) content_type_id: String, + pub(crate) content_item_id: String, 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<(), Error>> { Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6120,26 +14477,13 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = - 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::ApiManagementServiceResource = - 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), + 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 = @@ -6154,13 +14498,46 @@ pub mod api_management_service { } } } - pub mod update { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, +} +pub mod deleted_services { + use super::models; + 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 get_by_name( + &self, + service_name: impl Into, + subscription_id: impl Into, + location: impl Into, + ) -> get_by_name::Builder { + get_by_name::Builder { + client: self.0.clone(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + location: location.into(), + } + } + pub fn purge( + &self, + service_name: impl Into, + subscription_id: impl Into, + location: impl Into, + ) -> purge::Builder { + purge::Builder { + client: self.0.clone(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + location: location.into(), + } } + } + pub mod list_by_subscription { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6186,24 +14563,19 @@ pub mod api_management_service { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceUpdateParameters, 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.ApiManagement/service/{}", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/deletedservices", self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name + &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::PATCH); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6211,8 +14583,7 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -6220,11 +14591,10 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = + let rsp_value: models::DeletedServicesCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(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 = @@ -6239,14 +14609,8 @@ pub mod api_management_service { } } } - pub mod delete { + pub mod get_by_name { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202(models::ApiManagementServiceResource), - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6272,23 +14636,23 @@ pub mod api_management_service { #[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) location: 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.ApiManagement/service/{}", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/locations/{}/deletedservices/{}", self.client.endpoint(), &self.subscription_id, - &self.resource_group_name, + &self.location, &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6302,14 +14666,12 @@ pub mod api_management_service { let rsp = 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 => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = + let rsp_value: models::DeletedServiceContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Accepted202(rsp_value)) + Ok(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 = @@ -6324,8 +14686,14 @@ pub mod api_management_service { } } } - pub mod list_by_resource_group { + pub mod purge { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::DeletedServiceContract), + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6351,23 +14719,23 @@ pub mod api_management_service { #[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) location: 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.ApiManagement/service", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/locations/{}/deletedservices/{}", self.client.endpoint(), &self.subscription_id, - &self.resource_group_name + &self.location, + &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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6381,12 +14749,14 @@ pub mod api_management_service { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { + 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::ApiManagementServiceListResult = + let rsp_value: models::DeletedServiceContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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 = @@ -6401,6 +14771,15 @@ pub mod api_management_service { } } } +} +pub mod api_management_operations { + use super::models; + 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; #[derive(Debug, thiserror :: Error)] @@ -6428,18 +14807,11 @@ pub mod api_management_service { #[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> { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.ApiManagement/service", - self.client.endpoint(), - &self.subscription_id - ); + let url_str = &format!("{}/providers/Microsoft.ApiManagement/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); @@ -6458,7 +14830,7 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceListResult = + let rsp_value: models::OperationListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -6476,7 +14848,27 @@ pub mod api_management_service { } } } - pub mod get_sso_token { +} +pub mod api_management_service_skus { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets available SKUs for API Management service"] + pub fn list_available_service_skus( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_available_service_skus::Builder { + list_available_service_skus::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_available_service_skus { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6508,13 +14900,10 @@ pub mod api_management_service { 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.ApiManagement/service/{}/getssotoken", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/skus", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -6522,7 +14911,7 @@ pub mod api_management_service { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6531,7 +14920,6 @@ pub mod api_management_service { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); 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)?; @@ -6539,7 +14927,7 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceGetSsoTokenResult = + let rsp_value: models::ResourceSkuResults = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -6557,8 +14945,166 @@ pub mod api_management_service { } } } - pub mod check_name_availability { +} +pub mod api_management_service { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn restore( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> restore::Builder { + restore::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn backup( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> backup::Builder { + backup::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: 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(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + 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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: 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(), + 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 fn get_sso_token( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> get_sso_token::Builder { + get_sso_token::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + 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 get_domain_ownership_identifier(&self, subscription_id: impl Into) -> get_domain_ownership_identifier::Builder { + get_domain_ownership_identifier::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn apply_network_configuration_updates( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> apply_network_configuration_updates::Builder { + apply_network_configuration_updates::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + } + pub mod restore { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6584,19 +15130,20 @@ pub mod api_management_service { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) parameters: models::ApiManagementServiceCheckNameAvailabilityParameters, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, 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.ApiManagement/checkNameAvailability", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/restore", self.client.endpoint(), - &self.subscription_id + &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(); @@ -6617,10 +15164,11 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceNameAvailabilityResult = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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 = @@ -6635,8 +15183,13 @@ pub mod api_management_service { } } } - pub mod get_domain_ownership_identifier { + pub mod backup { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6662,20 +15215,20 @@ pub mod api_management_service { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, 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.ApiManagement/getDomainOwnershipIdentifier", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backup", self.client.endpoint(), - &self.subscription_id + &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(); @@ -6687,8 +15240,8 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + 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)?; @@ -6696,10 +15249,11 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceGetDomainOwnershipIdentifierResult = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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 = @@ -6711,16 +15265,11 @@ pub mod api_management_service { } } }) - } - } - } - pub mod apply_network_configuration_updates { - use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Ok200(models::ApiManagementServiceResource), + } } + } + pub mod get { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6749,19 +15298,22 @@ pub mod api_management_service { pub(crate) resource_group_name: String, pub(crate) 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> { + 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/{}/applynetworkconfigurationupdates" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", + 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6769,23 +15321,17 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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 - }; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -6801,114 +15347,14 @@ pub mod api_management_service { } } } -} -pub mod diagnostic { - use super::models; - 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, - diagnostic_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(), - diagnostic_id: diagnostic_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - diagnostic_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(), - diagnostic_id: diagnostic_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - diagnostic_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - diagnostic_id: diagnostic_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - diagnostic_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(), - diagnostic_id: diagnostic_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, - diagnostic_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(), - diagnostic_id: diagnostic_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Created201(models::ApiManagementServiceResource), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6936,28 +15382,14 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) parameters: models::ApiManagementServiceResource, 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> { + 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/{}/diagnostics", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -6965,7 +15397,7 @@ pub mod diagnostic { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6973,16 +15405,8 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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.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)?; @@ -6990,10 +15414,17 @@ pub mod diagnostic { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DiagnosticCollection = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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::ApiManagementServiceResource = + 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 = @@ -7008,8 +15439,13 @@ pub mod diagnostic { } } } - pub mod get { + pub mod update { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7037,23 +15473,22 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, + pub(crate) parameters: models::ApiManagementServiceUpdateParameters, 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.ApiManagement/service/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7061,7 +15496,8 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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)?; @@ -7069,10 +15505,11 @@ pub mod diagnostic { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DiagnosticContract = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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 = @@ -7087,12 +15524,13 @@ pub mod diagnostic { } } } - pub mod create_or_update { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::DiagnosticContract), - Ok200(models::DiagnosticContract), + Ok200, + Accepted202(models::ApiManagementServiceResource), + NoContent204, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7121,29 +15559,21 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, - pub(crate) parameters: models::DiagnosticContract, 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/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7151,28 +15581,20 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let 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::DiagnosticContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Created201(rsp_value)) - } - http::StatusCode::OK => { + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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::DiagnosticContract = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + 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 = @@ -7187,7 +15609,7 @@ pub mod diagnostic { } } } - pub mod update { + pub mod list_by_resource_group { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7215,26 +15637,22 @@ pub mod diagnostic { pub struct Builder { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) diagnostic_id: String, - pub(crate) parameters: models::DiagnosticContract, - pub(crate) if_match: String, 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.ApiManagement/service/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service", self.client.endpoint(), &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.diagnostic_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::PATCH); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7242,9 +15660,7 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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.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)?; @@ -7252,7 +15668,7 @@ pub mod diagnostic { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DiagnosticContract = + let rsp_value: models::ApiManagementServiceListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -7270,13 +15686,8 @@ pub mod diagnostic { } } } - pub mod delete { + pub mod list { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7302,26 +15713,21 @@ pub mod diagnostic { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) diagnostic_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> { + 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/{}/diagnostics/{}", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/service", self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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::DELETE); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7329,15 +15735,18 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -7352,7 +15761,7 @@ pub mod diagnostic { } } } - pub mod get_entity_tag { + pub mod get_sso_token { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7381,23 +15790,24 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/getssotoken", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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::HEAD); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7406,12 +15816,18 @@ pub mod diagnostic { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceGetSsoTokenResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -7426,113 +15842,7 @@ pub mod diagnostic { } } } -} -pub mod email_template { - use super::models; - 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, - template_name: 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(), - template_name: template_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - template_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(), - service_name: service_name.into(), - template_name: template_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - template_name: impl Into, - if_match: impl Into, - parameters: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - template_name: template_name.into(), - if_match: if_match.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - template_name: 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(), - template_name: template_name.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, - template_name: 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(), - template_name: template_name.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod check_name_availability { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7559,38 +15869,23 @@ pub mod email_template { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, + pub(crate) parameters: models::ApiManagementServiceCheckNameAvailabilityParameters, 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> { + 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/{}/templates", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/checkNameAvailability", self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name + &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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7598,16 +15893,8 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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.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)?; @@ -7615,7 +15902,7 @@ pub mod email_template { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateCollection = + let rsp_value: models::ApiManagementServiceNameAvailabilityResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -7633,7 +15920,7 @@ pub mod email_template { } } } - pub mod get { + pub mod get_domain_ownership_identifier { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7660,25 +15947,24 @@ pub mod email_template { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) template_name: String, 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.ApiManagement/service/{}/templates/{}", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier", self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.template_name + &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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7687,6 +15973,7 @@ pub mod email_template { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); 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)?; @@ -7694,7 +15981,7 @@ pub mod email_template { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateContract = + let rsp_value: models::ApiManagementServiceGetDomainOwnershipIdentifierResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -7712,12 +15999,12 @@ pub mod email_template { } } } - pub mod create_or_update { + pub mod apply_network_configuration_updates { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::EmailTemplateContract), - Ok200(models::EmailTemplateContract), + Accepted202, + Ok200(models::ApiManagementServiceResource), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7746,29 +16033,20 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, - pub(crate) parameters: models::EmailTemplateUpdateParameters, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) parameters: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + 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.ApiManagement/service/{}/templates/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.template_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/applynetworkconfigurationupdates" , 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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7776,25 +16054,21 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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); - } + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateContract = - 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), http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateContract = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -7812,7 +16086,113 @@ pub mod email_template { } } } - pub mod update { +} +pub mod diagnostic { + use super::models; + 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, + diagnostic_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(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + diagnostic_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(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + diagnostic_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + diagnostic_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(), + diagnostic_id: diagnostic_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, + diagnostic_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(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7841,25 +16221,36 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, - pub(crate) if_match: String, - pub(crate) parameters: models::EmailTemplateUpdateParameters, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/templates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.template_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7867,9 +16258,16 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - req_builder = req_builder.header("If-Match", &self.if_match); - 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(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)?; @@ -7877,7 +16275,7 @@ pub mod email_template { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateContract = + let rsp_value: models::DiagnosticCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -7895,13 +16293,8 @@ pub mod email_template { } } } - pub mod delete { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7929,24 +16322,23 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, - pub(crate) if_match: String, + pub(crate) diagnostic_id: String, 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.ApiManagement/service/{}/templates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.template_name + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7954,15 +16346,18 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -7977,8 +16372,13 @@ pub mod email_template { } } } - pub mod get_entity_tag { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::DiagnosticContract), + Ok200(models::DiagnosticContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8006,23 +16406,29 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/templates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.template_name + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8030,13 +16436,28 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(()), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + 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::DiagnosticContract = + 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 = @@ -8051,162 +16472,7 @@ pub mod email_template { } } } -} -pub mod gateway { - use super::models; - 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, - gateway_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(), - gateway_id: gateway_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_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(), - gateway_id: gateway_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - gateway_id: gateway_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_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(), - gateway_id: gateway_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, - gateway_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(), - gateway_id: gateway_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_keys( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - subscription_id: impl Into, - ) -> list_keys::Builder { - list_keys::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - gateway_id: gateway_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn regenerate_key( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: 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(), - service_name: service_name.into(), - gateway_id: gateway_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn generate_token( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - parameters: impl Into, - subscription_id: impl Into, - ) -> generate_token::Builder { - generate_token::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - gateway_id: gateway_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8235,36 +16501,25 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + pub(crate) if_match: 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> { + 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/{}/gateways", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8272,16 +16527,9 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.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)?; @@ -8289,7 +16537,7 @@ pub mod gateway { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayCollection = + let rsp_value: models::DiagnosticContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -8307,8 +16555,13 @@ pub mod gateway { } } } - pub mod get { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8336,23 +16589,24 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, + pub(crate) diagnostic_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> { + 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/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8360,18 +16614,15 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -8386,13 +16637,8 @@ pub mod gateway { } } } - pub mod create_or_update { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::GatewayContract), - Ok200(models::GatewayContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8420,29 +16666,23 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) parameters: models::GatewayContract, + pub(crate) diagnostic_id: String, 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> { + 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/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8450,28 +16690,13 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::GatewayContract = - 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::GatewayContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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 = @@ -8486,7 +16711,113 @@ pub mod gateway { } } } - pub mod update { +} +pub mod email_template { + use super::models; + 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, + template_name: 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(), + template_name: template_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + template_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(), + service_name: service_name.into(), + template_name: template_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + template_name: impl Into, + if_match: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + template_name: template_name.into(), + if_match: if_match.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + template_name: 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(), + template_name: template_name.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, + template_name: 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(), + template_name: template_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8515,25 +16846,36 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) parameters: models::GatewayContract, - pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.gateway_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8541,9 +16883,16 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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.header("If-Match", &self.if_match); + 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)?; @@ -8551,7 +16900,7 @@ pub mod gateway { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayContract = + let rsp_value: models::EmailTemplateCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -8569,13 +16918,8 @@ pub mod gateway { } } } - pub mod delete { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8603,24 +16947,23 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) if_match: String, + pub(crate) template_name: String, 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.ApiManagement/service/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8628,15 +16971,18 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EmailTemplateContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -8651,8 +16997,13 @@ pub mod gateway { } } } - pub mod get_entity_tag { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::EmailTemplateContract), + Ok200(models::EmailTemplateContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8680,23 +17031,29 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, + pub(crate) template_name: String, + pub(crate) parameters: models::EmailTemplateUpdateParameters, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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::HEAD); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8704,13 +17061,28 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(()), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EmailTemplateContract = + 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::EmailTemplateContract = + 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 = @@ -8725,7 +17097,7 @@ pub mod gateway { } } } - pub mod list_keys { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8754,23 +17126,25 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, + pub(crate) template_name: String, + pub(crate) if_match: String, + pub(crate) parameters: models::EmailTemplateUpdateParameters, 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.ApiManagement/service/{}/gateways/{}/listKeys", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8778,8 +17152,9 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.header("If-Match", &self.if_match); + 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)?; @@ -8787,7 +17162,7 @@ pub mod gateway { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayKeysContract = + let rsp_value: models::EmailTemplateContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -8805,8 +17180,13 @@ pub mod gateway { } } } - pub mod regenerate_key { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8834,24 +17214,24 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) parameters: models::GatewayKeyRegenerationRequestContract, + pub(crate) template_name: 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<(), Error>> { + 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/{}/gateways/{}/regenerateKey", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8859,14 +17239,15 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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.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::NO_CONTENT => Ok(()), + 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 = @@ -8881,7 +17262,7 @@ pub mod gateway { } } } - pub mod generate_token { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8910,24 +17291,23 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) parameters: models::GatewayTokenRequestContract, + pub(crate) template_name: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/generateToken", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8935,19 +17315,13 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayTokenContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -8963,7 +17337,7 @@ pub mod gateway { } } } -pub mod gateway_hostname_configuration { +pub mod gateway { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -8971,14 +17345,12 @@ pub mod gateway_hostname_configuration { &self, resource_group_name: impl Into, service_name: impl Into, - gateway_id: 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(), - gateway_id: gateway_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, @@ -8990,7 +17362,6 @@ pub mod gateway_hostname_configuration { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - hc_id: impl Into, subscription_id: impl Into, ) -> get::Builder { get::Builder { @@ -8998,7 +17369,6 @@ pub mod gateway_hostname_configuration { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - hc_id: hc_id.into(), subscription_id: subscription_id.into(), } } @@ -9007,8 +17377,7 @@ pub mod gateway_hostname_configuration { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - hc_id: impl Into, - parameters: impl Into, + parameters: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -9016,18 +17385,35 @@ pub mod gateway_hostname_configuration { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - hc_id: hc_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, } } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - hc_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -9036,7 +17422,6 @@ pub mod gateway_hostname_configuration { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - hc_id: hc_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -9046,7 +17431,6 @@ pub mod gateway_hostname_configuration { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - hc_id: impl Into, subscription_id: impl Into, ) -> get_entity_tag::Builder { get_entity_tag::Builder { @@ -9054,7 +17438,55 @@ pub mod gateway_hostname_configuration { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - hc_id: hc_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_keys( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + subscription_id: impl Into, + ) -> list_keys::Builder { + list_keys::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn regenerate_key( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: 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(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn generate_token( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> generate_token::Builder { + generate_token::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + parameters: parameters.into(), subscription_id: subscription_id.into(), } } @@ -9088,7 +17520,6 @@ pub mod gateway_hostname_configuration { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, @@ -9107,12 +17538,15 @@ pub mod gateway_hostname_configuration { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/gateways/{}/hostnameConfigurations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/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); @@ -9140,7 +17574,7 @@ pub mod gateway_hostname_configuration { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayHostnameConfigurationCollection = + let rsp_value: models::GatewayCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -9188,15 +17622,19 @@ pub mod gateway_hostname_configuration { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) hc_id: String, 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.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_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); @@ -9215,7 +17653,7 @@ pub mod gateway_hostname_configuration { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayHostnameConfigurationContract = + let rsp_value: models::GatewayContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -9237,8 +17675,8 @@ pub mod gateway_hostname_configuration { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::GatewayHostnameConfigurationContract), - Ok200(models::GatewayHostnameConfigurationContract), + Created201(models::GatewayContract), + Ok200(models::GatewayContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9268,8 +17706,7 @@ pub mod gateway_hostname_configuration { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) hc_id: String, - pub(crate) parameters: models::GatewayHostnameConfigurationContract, + pub(crate) parameters: models::GatewayContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -9280,7 +17717,14 @@ pub mod gateway_hostname_configuration { } 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/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_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); @@ -9291,11 +17735,11 @@ pub mod gateway_hostname_configuration { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + 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.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)?; @@ -9303,13 +17747,13 @@ pub mod gateway_hostname_configuration { 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::GatewayHostnameConfigurationContract = + let rsp_value: models::GatewayContract = 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::GatewayHostnameConfigurationContract = + let rsp_value: models::GatewayContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -9327,13 +17771,8 @@ pub mod gateway_hostname_configuration { } } } - pub mod delete { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9362,17 +17801,24 @@ pub mod gateway_hostname_configuration { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) hc_id: String, + pub(crate) parameters: models::GatewayContract, pub(crate) if_match: String, 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.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9380,15 +17826,20 @@ pub mod gateway_hostname_configuration { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + 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.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), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -9403,8 +17854,13 @@ pub mod gateway_hostname_configuration { } } } - pub mod get_entity_tag { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9433,16 +17889,23 @@ pub mod gateway_hostname_configuration { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) hc_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<(), Error>> { + 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/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9450,13 +17913,15 @@ pub mod gateway_hostname_configuration { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + 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(()), + 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 = @@ -9471,83 +17936,7 @@ pub mod gateway_hostname_configuration { } } } -} -pub mod gateway_api { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_service( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: 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(), - gateway_id: gateway_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - api_id: 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(), - gateway_id: gateway_id.into(), - api_id: api_id.into(), - subscription_id: subscription_id.into(), - parameters: None, - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - api_id: 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(), - gateway_id: gateway_id.into(), - api_id: api_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn get_entity_tag( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - api_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(), - gateway_id: gateway_id.into(), - api_id: api_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9578,27 +17967,12 @@ pub mod gateway_api { pub(crate) service_name: String, pub(crate) gateway_id: 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> { + 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/{}/gateways/{}/apis", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -9607,7 +17981,7 @@ pub mod gateway_api { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9615,27 +17989,13 @@ pub mod gateway_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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::ApiCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -9650,13 +18010,8 @@ pub mod gateway_api { } } } - pub mod create_or_update { + pub mod list_keys { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ApiContract), - Ok200(models::ApiContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9685,29 +18040,22 @@ pub mod gateway_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) api_id: 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> { + 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/{}/gateways/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/listKeys", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id, - &self.api_id + &self.gateway_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9715,28 +18063,18 @@ pub mod gateway_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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 - }; + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiContract = - 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::ApiContract = + let rsp_value: models::GatewayKeysContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -9752,13 +18090,8 @@ pub mod gateway_api { } } } - pub mod delete { + pub mod regenerate_key { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9787,24 +18120,23 @@ pub mod gateway_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) api_id: String, + pub(crate) parameters: models::GatewayKeyRegenerationRequestContract, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/regenerateKey", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id, - &self.api_id + &self.gateway_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9812,14 +18144,14 @@ pub mod gateway_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::NO_CONTENT => Ok(Response::NoContent204), + 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::ErrorResponse = @@ -9834,7 +18166,7 @@ pub mod gateway_api { } } } - pub mod get_entity_tag { + pub mod generate_token { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9864,24 +18196,23 @@ pub mod gateway_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) api_id: String, + pub(crate) parameters: models::GatewayTokenRequestContract, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/gateways/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/generateToken", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id, - &self.api_id + &self.gateway_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9889,13 +18220,19 @@ pub mod gateway_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayTokenContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -9911,7 +18248,7 @@ pub mod gateway_api { } } } -pub mod gateway_certificate_authority { +pub mod gateway_hostname_configuration { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -9938,7 +18275,7 @@ pub mod gateway_certificate_authority { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - certificate_id: impl Into, + hc_id: impl Into, subscription_id: impl Into, ) -> get::Builder { get::Builder { @@ -9946,7 +18283,7 @@ pub mod gateway_certificate_authority { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - certificate_id: certificate_id.into(), + hc_id: hc_id.into(), subscription_id: subscription_id.into(), } } @@ -9955,8 +18292,8 @@ pub mod gateway_certificate_authority { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - certificate_id: impl Into, - parameters: impl Into, + hc_id: impl Into, + parameters: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -9964,7 +18301,7 @@ pub mod gateway_certificate_authority { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - certificate_id: certificate_id.into(), + hc_id: hc_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -9975,7 +18312,7 @@ pub mod gateway_certificate_authority { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - certificate_id: impl Into, + hc_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -9984,7 +18321,7 @@ pub mod gateway_certificate_authority { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - certificate_id: certificate_id.into(), + hc_id: hc_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -9994,7 +18331,7 @@ pub mod gateway_certificate_authority { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - certificate_id: impl Into, + hc_id: impl Into, subscription_id: impl Into, ) -> get_entity_tag::Builder { get_entity_tag::Builder { @@ -10002,7 +18339,7 @@ pub mod gateway_certificate_authority { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - certificate_id: certificate_id.into(), + hc_id: hc_id.into(), subscription_id: subscription_id.into(), } } @@ -10057,10 +18394,10 @@ pub mod gateway_certificate_authority { } pub fn into_future( self, - ) -> futures::future::BoxFuture<'static, std::result::Result> + ) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_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); @@ -10088,7 +18425,7 @@ pub mod gateway_certificate_authority { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayCertificateAuthorityCollection = + let rsp_value: models::GatewayHostnameConfigurationCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -10136,15 +18473,15 @@ pub mod gateway_certificate_authority { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) certificate_id: String, + pub(crate) hc_id: String, pub(crate) subscription_id: String, } impl Builder { pub fn into_future( self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + ) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_id) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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); @@ -10163,7 +18500,7 @@ pub mod gateway_certificate_authority { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayCertificateAuthorityContract = + let rsp_value: models::GatewayHostnameConfigurationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -10185,8 +18522,8 @@ pub mod gateway_certificate_authority { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::GatewayCertificateAuthorityContract), - Ok200(models::GatewayCertificateAuthorityContract), + Created201(models::GatewayHostnameConfigurationContract), + Ok200(models::GatewayHostnameConfigurationContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -10216,8 +18553,8 @@ pub mod gateway_certificate_authority { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) certificate_id: String, - pub(crate) parameters: models::GatewayCertificateAuthorityContract, + pub(crate) hc_id: String, + pub(crate) parameters: models::GatewayHostnameConfigurationContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -10228,7 +18565,7 @@ pub mod gateway_certificate_authority { } 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/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_id) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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); @@ -10251,13 +18588,13 @@ pub mod gateway_certificate_authority { 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::GatewayCertificateAuthorityContract = + let rsp_value: models::GatewayHostnameConfigurationContract = 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::GatewayCertificateAuthorityContract = + let rsp_value: models::GatewayHostnameConfigurationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -10310,14 +18647,14 @@ pub mod gateway_certificate_authority { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) certificate_id: String, + pub(crate) hc_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/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_id) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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); @@ -10381,13 +18718,13 @@ pub mod gateway_certificate_authority { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) certificate_id: String, + pub(crate) hc_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/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_id) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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); @@ -10420,7 +18757,7 @@ pub mod gateway_certificate_authority { } } } -pub mod group { +pub mod gateway_api { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -10428,84 +18765,52 @@ pub mod group { &self, resource_group_name: impl Into, service_name: impl Into, + gateway_id: 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(), + gateway_id: gateway_id.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, - group_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(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), - } - } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - parameters: impl Into, + gateway_id: impl Into, + api_id: 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(), - group_id: group_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - group_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - group_id: group_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), + gateway_id: gateway_id.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), + parameters: None, } } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - if_match: impl Into, + gateway_id: impl Into, + api_id: 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(), - group_id: group_id.into(), - if_match: if_match.into(), + gateway_id: gateway_id.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), } } @@ -10513,14 +18818,16 @@ pub mod group { &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, + gateway_id: impl Into, + api_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(), - group_id: group_id.into(), + gateway_id: gateway_id.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), } } @@ -10554,6 +18861,7 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) gateway_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, @@ -10572,14 +18880,15 @@ pub mod group { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/groups", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.gateway_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -10595,201 +18904,22 @@ pub mod group { 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::GroupCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) group_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/{}/groups/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.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", "2021-01-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GroupContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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; - #[derive(Debug)] - pub enum Response { - Created201(models::GroupContract), - Ok200(models::GroupContract), - } - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) group_id: String, - pub(crate) parameters: models::GroupCreateParameters, - 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/{}/groups/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.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::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", "2021-01-01-preview"); - 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); + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GroupContract = - 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::GroupContract = + let rsp_value: models::ApiCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -10805,8 +18935,13 @@ pub mod group { } } } - pub mod update { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ApiContract), + Ok200(models::ApiContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -10834,25 +18969,30 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) parameters: models::GroupUpdateParameters, - pub(crate) if_match: String, + pub(crate) gateway_id: String, + pub(crate) api_id: String, pub(crate) subscription_id: String, + pub(crate) parameters: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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.ApiManagement/service/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.gateway_id, + &self.api_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -10860,19 +19000,28 @@ pub mod group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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.header("If-Match", &self.if_match); + 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::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiContract = + 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::GroupContract = + let rsp_value: models::ApiContract = 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)?; @@ -10922,20 +19071,21 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) if_match: String, + pub(crate) gateway_id: String, + pub(crate) api_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/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.gateway_id, + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -10947,7 +19097,6 @@ pub mod group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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)?; @@ -10999,19 +19148,21 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, + pub(crate) gateway_id: String, + pub(crate) api_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/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.gateway_id, + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -11045,81 +19196,103 @@ pub mod group { } } } -pub mod group_user { +pub mod gateway_certificate_authority { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, + gateway_id: impl Into, subscription_id: impl Into, - ) -> list::Builder { - list::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - group_id: group_id.into(), + gateway_id: gateway_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, } } - pub fn create( + pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - user_id: impl Into, + gateway_id: impl Into, + certificate_id: impl Into, subscription_id: impl Into, - ) -> create::Builder { - create::Builder { + ) -> get::Builder { + get::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - group_id: group_id.into(), - user_id: user_id.into(), + gateway_id: gateway_id.into(), + certificate_id: certificate_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + certificate_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(), + gateway_id: gateway_id.into(), + certificate_id: certificate_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, - group_id: impl Into, - user_id: impl Into, + gateway_id: impl Into, + certificate_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(), - group_id: group_id.into(), - user_id: user_id.into(), + gateway_id: gateway_id.into(), + certificate_id: certificate_id.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } - pub fn check_entity_exists( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - user_id: impl Into, + gateway_id: impl Into, + certificate_id: impl Into, subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - group_id: group_id.into(), - user_id: user_id.into(), + gateway_id: gateway_id.into(), + certificate_id: certificate_id.into(), subscription_id: subscription_id.into(), } } } - pub mod list { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11148,7 +19321,7 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, + pub(crate) gateway_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, @@ -11167,16 +19340,12 @@ pub mod group_user { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/groups/{}/users", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_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); @@ -11204,7 +19373,7 @@ pub mod group_user { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::UserCollection = + let rsp_value: models::GatewayCertificateAuthorityCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -11222,12 +19391,87 @@ pub mod group_user { } } } - pub mod create { + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) gateway_id: String, + pub(crate) certificate_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/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayCertificateAuthorityContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; #[derive(Debug)] pub enum Response { - Created201(models::UserContract), - Ok200(models::UserContract), + Created201(models::GatewayCertificateAuthorityContract), + Ok200(models::GatewayCertificateAuthorityContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11256,22 +19500,20 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) user_id: String, + pub(crate) gateway_id: String, + pub(crate) certificate_id: String, + pub(crate) parameters: models::GatewayCertificateAuthorityContract, 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/{}/groups/{}/users/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id, - &self.user_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_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); @@ -11282,7 +19524,11 @@ pub mod group_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - let req_body = azure_core::EMPTY_BODY; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + 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)?; @@ -11290,13 +19536,13 @@ pub mod group_user { 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::UserContract = + let rsp_value: models::GatewayCertificateAuthorityContract = 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::UserContract = + let rsp_value: models::GatewayCertificateAuthorityContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -11348,22 +19594,15 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) user_id: String, + pub(crate) gateway_id: String, + pub(crate) certificate_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/{}/groups/{}/users/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id, - &self.user_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_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); @@ -11374,6 +19613,7 @@ pub mod group_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + 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)?; @@ -11396,12 +19636,10 @@ pub mod group_user { } } } - pub mod check_entity_exists { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Error response #response_type")] - NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -11427,22 +19665,14 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) user_id: String, + pub(crate) gateway_id: String, + pub(crate) certificate_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/{}/groups/{}/users/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id, - &self.user_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_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); @@ -11459,8 +19689,7 @@ pub mod group_user { let 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(()), - http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + 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 = @@ -11476,7 +19705,7 @@ pub mod group_user { } } } -pub mod identity_provider { +pub mod group { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -11491,20 +19720,23 @@ pub mod identity_provider { 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, - identity_provider_name: impl Into, + group_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(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -11512,15 +19744,15 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, - parameters: impl Into, + group_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(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -11530,8 +19762,8 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, - parameters: impl Into, + group_id: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -11539,7 +19771,7 @@ pub mod identity_provider { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), @@ -11549,7 +19781,7 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, + group_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -11557,7 +19789,7 @@ pub mod identity_provider { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -11566,29 +19798,14 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, + group_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(), - identity_provider_name: identity_provider_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_secrets( - &self, - resource_group_name: impl Into, - service_name: impl Into, - identity_provider_name: impl Into, - subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -11623,12 +19840,27 @@ pub mod identity_provider { 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 into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/identityProviders", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -11644,6 +19876,15 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + 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)?; @@ -11652,7 +19893,7 @@ pub mod identity_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IdentityProviderList = + let rsp_value: models::GroupCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -11699,19 +19940,19 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, + pub(crate) group_id: String, 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.ApiManagement/service/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -11731,7 +19972,7 @@ pub mod identity_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IdentityProviderContract = + let rsp_value: models::GroupContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -11753,8 +19994,8 @@ pub mod identity_provider { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::IdentityProviderContract), - Ok200(models::IdentityProviderContract), + Created201(models::GroupContract), + Ok200(models::GroupContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11783,8 +20024,8 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, - pub(crate) parameters: models::IdentityProviderCreateContract, + pub(crate) group_id: String, + pub(crate) parameters: models::GroupCreateParameters, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -11796,12 +20037,12 @@ pub mod identity_provider { 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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -11825,13 +20066,13 @@ pub mod identity_provider { 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::IdentityProviderContract = + let rsp_value: models::GroupContract = 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::IdentityProviderContract = + let rsp_value: models::GroupContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -11878,21 +20119,21 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, - pub(crate) parameters: models::IdentityProviderUpdateParameters, + pub(crate) group_id: String, + pub(crate) parameters: models::GroupUpdateParameters, pub(crate) if_match: String, 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.ApiManagement/service/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -11904,20 +20145,102 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GroupContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) group_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/{}/groups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.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::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", "2021-01-01-preview"); 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IdentityProviderContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -11932,13 +20255,8 @@ pub mod identity_provider { } } } - pub mod delete { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -11966,24 +20284,23 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, - pub(crate) if_match: String, + pub(crate) group_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.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::DELETE); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11991,15 +20308,13 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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), + 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 = @@ -12014,7 +20329,82 @@ pub mod identity_provider { } } } - pub mod get_entity_tag { +} +pub mod group_user { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn create( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + user_id: 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(), + group_id: group_id.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12043,23 +20433,38 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, + pub(crate) group_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.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::HEAD); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12067,13 +20472,27 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + 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 => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UserCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -12088,8 +20507,13 @@ pub mod identity_provider { } } } - pub mod list_secrets { + pub mod create { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::UserContract), + Ok200(models::UserContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12117,16 +20541,25 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, + pub(crate) group_id: String, + pub(crate) user_id: String, 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.ApiManagement/service/{}/identityProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . identity_provider_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.group_id, + &self.user_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12135,17 +20568,22 @@ pub mod identity_provider { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); 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::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UserContract = + 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::ClientSecretContract = + let rsp_value: models::UserContract = 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)?; @@ -12161,45 +20599,13 @@ pub mod identity_provider { } } } -} -pub mod issue { - use super::models; - 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, - issue_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(), - issue_id: issue_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12221,42 +20627,31 @@ pub mod issue { ResponseBytes(#[source] azure_core::error::Error), #[error("Failed to deserialize response, body: {1:?}")] Deserialize(#[source] 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> { + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) group_id: String, + pub(crate) user_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/{}/issues", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.group_id, + &self.user_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12264,27 +20659,14 @@ pub mod issue { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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::IssueCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -12299,10 +20681,12 @@ pub mod issue { } } } - pub mod get { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -12328,23 +20712,25 @@ pub mod issue { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) issue_id: String, + pub(crate) group_id: String, + pub(crate) user_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/issues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.issue_id + &self.group_id, + &self.user_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12358,12 +20744,8 @@ pub mod issue { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IssueContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + http::StatusCode::NO_CONTENT => Ok(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -12379,7 +20761,7 @@ pub mod issue { } } } -pub mod logger { +pub mod identity_provider { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -12394,23 +20776,20 @@ pub mod logger { 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, - logger_id: impl Into, + identity_provider_name: 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(), - logger_id: logger_id.into(), + identity_provider_name: identity_provider_name.into(), subscription_id: subscription_id.into(), } } @@ -12418,15 +20797,15 @@ pub mod logger { &self, resource_group_name: impl Into, service_name: impl Into, - logger_id: impl Into, - parameters: impl Into, + identity_provider_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(), service_name: service_name.into(), - logger_id: logger_id.into(), + identity_provider_name: identity_provider_name.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -12436,8 +20815,8 @@ pub mod logger { &self, resource_group_name: impl Into, service_name: impl Into, - logger_id: impl Into, - parameters: impl Into, + identity_provider_name: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -12445,7 +20824,7 @@ pub mod logger { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - logger_id: logger_id.into(), + identity_provider_name: identity_provider_name.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), @@ -12455,7 +20834,7 @@ pub mod logger { &self, resource_group_name: impl Into, service_name: impl Into, - logger_id: impl Into, + identity_provider_name: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -12463,7 +20842,7 @@ pub mod logger { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - logger_id: logger_id.into(), + identity_provider_name: identity_provider_name.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -12472,14 +20851,29 @@ pub mod logger { &self, resource_group_name: impl Into, service_name: impl Into, - logger_id: impl Into, + identity_provider_name: 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(), - logger_id: logger_id.into(), + identity_provider_name: identity_provider_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + identity_provider_name: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + identity_provider_name: identity_provider_name.into(), subscription_id: subscription_id.into(), } } @@ -12514,27 +20908,12 @@ pub mod logger { 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> { + 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/{}/loggers", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -12550,15 +20929,6 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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)?; @@ -12567,7 +20937,7 @@ pub mod logger { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::LoggerCollection = + let rsp_value: models::IdentityProviderList = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -12614,19 +20984,19 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, + pub(crate) identity_provider_name: String, 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.ApiManagement/service/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.identity_provider_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -12646,7 +21016,7 @@ pub mod logger { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::LoggerContract = + let rsp_value: models::IdentityProviderContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -12668,8 +21038,8 @@ pub mod logger { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::LoggerContract), - Ok200(models::LoggerContract), + Created201(models::IdentityProviderContract), + Ok200(models::IdentityProviderContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12698,8 +21068,8 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, - pub(crate) parameters: models::LoggerContract, + pub(crate) identity_provider_name: String, + pub(crate) parameters: models::IdentityProviderCreateContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -12711,12 +21081,12 @@ pub mod logger { 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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.identity_provider_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -12740,13 +21110,13 @@ pub mod logger { 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::LoggerContract = + let rsp_value: models::IdentityProviderContract = 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::LoggerContract = + let rsp_value: models::IdentityProviderContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -12793,21 +21163,21 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, - pub(crate) parameters: models::LoggerUpdateContract, + pub(crate) identity_provider_name: String, + pub(crate) parameters: models::IdentityProviderUpdateParameters, pub(crate) if_match: String, 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.ApiManagement/service/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.identity_provider_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -12829,7 +21199,7 @@ pub mod logger { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::LoggerContract = + let rsp_value: models::IdentityProviderContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -12847,90 +21217,13 @@ pub mod logger { } } } - pub mod delete { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) logger_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/{}/loggers/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.logger_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", "2021-01-01-preview"); - 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 { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12958,23 +21251,24 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, + pub(crate) identity_provider_name: 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<(), Error>> { + 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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.identity_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::HEAD); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12982,13 +21276,15 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + 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(()), + 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 = @@ -13003,144 +21299,7 @@ pub mod logger { } } } -} -pub mod named_value { - use super::models; - 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, - is_key_vault_refresh_failed: None, - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - named_value_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(), - named_value_id: named_value_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - named_value_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(), - named_value_id: named_value_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - named_value_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - named_value_id: named_value_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - named_value_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(), - named_value_id: named_value_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, - named_value_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(), - named_value_id: named_value_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_value( - &self, - resource_group_name: impl Into, - service_name: impl Into, - named_value_id: impl Into, - subscription_id: impl Into, - ) -> list_value::Builder { - list_value::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - named_value_id: named_value_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn refresh_secret( - &self, - resource_group_name: impl Into, - service_name: impl Into, - named_value_id: impl Into, - subscription_id: impl Into, - ) -> refresh_secret::Builder { - refresh_secret::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - named_value_id: named_value_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13169,41 +21328,23 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) identity_provider_name: String, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, - pub(crate) is_key_vault_refresh_failed: 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 is_key_vault_refresh_failed(mut self, is_key_vault_refresh_failed: bool) -> Self { - self.is_key_vault_refresh_failed = Some(is_key_vault_refresh_failed); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/namedValues", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.identity_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13211,31 +21352,13 @@ pub mod named_value { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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()); - } - if let Some(is_key_vault_refresh_failed) = &self.is_key_vault_refresh_failed { - url.query_pairs_mut() - .append_pair("isKeyVaultRefreshFailed", &is_key_vault_refresh_failed.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::NamedValueCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -13250,7 +21373,7 @@ pub mod named_value { } } } - pub mod get { + pub mod list_secrets { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13279,23 +21402,16 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, + pub(crate) identity_provider_name: String, 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.ApiManagement/service/{}/namedValues/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.named_value_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . identity_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13304,6 +21420,7 @@ pub mod named_value { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); 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)?; @@ -13311,7 +21428,7 @@ pub mod named_value { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NamedValueContract = + let rsp_value: models::ClientSecretContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -13329,14 +21446,45 @@ pub mod named_value { } } } - pub mod create_or_update { +} +pub mod issue { + use super::models; + 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, + issue_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(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Created201(models::NamedValueContract), - Ok200(models::NamedValueContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13364,29 +21512,36 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, - pub(crate) parameters: models::NamedValueCreateContract, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + 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> { + 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/{}/namedValues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/issues", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.named_value_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13394,28 +21549,26 @@ pub mod named_value { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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); + 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::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NamedValueContract = - 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::NamedValueContract = + let rsp_value: models::IssueCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -13431,13 +21584,8 @@ pub mod named_value { } } } - pub mod update { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Ok200(models::NamedValueContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13465,25 +21613,23 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, - pub(crate) parameters: models::NamedValueUpdateParameters, - pub(crate) if_match: String, + pub(crate) issue_id: String, 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.ApiManagement/service/{}/namedValues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/issues/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.named_value_id + &self.issue_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13491,20 +21637,17 @@ pub mod named_value { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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.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::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::NamedValueContract = + let rsp_value: models::IssueContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -13520,13 +21663,114 @@ pub mod named_value { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, +} +pub mod logger { + use super::models; + 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, + logger_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(), + logger_id: logger_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + logger_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(), + logger_id: logger_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + logger_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + logger_id: logger_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + logger_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(), + logger_id: logger_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, + logger_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(), + logger_id: logger_id.into(), + subscription_id: subscription_id.into(), + } } + } + pub mod list_by_service { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13554,24 +21798,36 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, - pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/namedValues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.named_value_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13579,15 +21835,27 @@ pub mod named_value { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - req_builder = req_builder.header("If-Match", &self.if_match); + 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 => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoggerCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -13602,7 +21870,7 @@ pub mod named_value { } } } - pub mod get_entity_tag { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13631,23 +21899,23 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, + pub(crate) logger_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/namedValues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.named_value_id + &self.logger_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13661,7 +21929,12 @@ pub mod named_value { let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoggerContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -13676,8 +21949,13 @@ pub mod named_value { } } } - pub mod list_value { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::LoggerContract), + Ok200(models::LoggerContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13705,23 +21983,29 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, + pub(crate) logger_id: String, + pub(crate) parameters: models::LoggerContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/namedValues/{}/listValue", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.named_value_id + &self.logger_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13729,18 +22013,27 @@ pub mod named_value { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + 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::LoggerContract = + 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::NamedValueSecretContract = + let rsp_value: models::LoggerContract = 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)?; @@ -13756,13 +22049,8 @@ pub mod named_value { } } } - pub mod refresh_secret { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Ok200(models::NamedValueContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13790,23 +22078,25 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, + pub(crate) logger_id: String, + pub(crate) parameters: models::LoggerUpdateContract, + pub(crate) if_match: String, 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.ApiManagement/service/{}/namedValues/{}/refreshSecret", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.named_value_id + &self.logger_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13814,19 +22104,19 @@ pub mod named_value { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + 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.header("If-Match", &self.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::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::NamedValueContract = + let rsp_value: models::LoggerContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -13842,42 +22132,13 @@ pub mod named_value { } } } -} -pub mod network_status { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_service( - &self, - subscription_id: impl Into, - resource_group_name: impl Into, - service_name: impl Into, - ) -> list_by_service::Builder { - list_by_service::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_by_location( - &self, - subscription_id: impl Into, - resource_group_name: impl Into, - service_name: impl Into, - location_name: impl Into, - ) -> list_by_location::Builder { - list_by_location::Builder { - client: self.0.clone(), - subscription_id: subscription_id.into(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - location_name: location_name.into(), - } - } - } - pub mod list_by_service { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13903,25 +22164,26 @@ pub mod network_status { #[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) logger_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, Error>> { + 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/{}/networkstatus", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.logger_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13929,18 +22191,15 @@ pub mod network_status { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + 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 => { - 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) - } + 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 = @@ -13955,7 +22214,7 @@ pub mod network_status { } } } - pub mod list_by_location { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13982,25 +22241,25 @@ pub mod network_status { #[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) location_name: String, + pub(crate) logger_id: String, + 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/locations/{}/networkstatus", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.location_name + &self.logger_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14014,12 +22273,7 @@ pub mod network_status { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NetworkStatusContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -14033,56 +22287,141 @@ pub mod network_status { }) } } - } -} -pub mod notification { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_service( + } +} +pub mod named_value { + use super::models; + 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, + is_key_vault_refresh_failed: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_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(), + named_value_id: named_value_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_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(), + named_value_id: named_value_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + named_value_id: named_value_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_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(), + named_value_id: named_value_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, + named_value_id: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + named_value_id: named_value_id.into(), subscription_id: subscription_id.into(), - top: None, - skip: None, } } - pub fn get( + pub fn list_value( &self, resource_group_name: impl Into, service_name: impl Into, - notification_name: impl Into, + named_value_id: impl Into, subscription_id: impl Into, - ) -> get::Builder { - get::Builder { + ) -> list_value::Builder { + list_value::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - notification_name: notification_name.into(), + named_value_id: named_value_id.into(), subscription_id: subscription_id.into(), } } - pub fn create_or_update( + pub fn refresh_secret( &self, resource_group_name: impl Into, service_name: impl Into, - notification_name: impl Into, + named_value_id: impl Into, subscription_id: impl Into, - ) -> create_or_update::Builder { - create_or_update::Builder { + ) -> refresh_secret::Builder { + refresh_secret::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - notification_name: notification_name.into(), + named_value_id: named_value_id.into(), subscription_id: subscription_id.into(), - if_match: None, } } } @@ -14116,10 +22455,16 @@ pub mod notification { 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, + pub(crate) is_key_vault_refresh_failed: 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 @@ -14128,10 +22473,14 @@ pub mod notification { self.skip = Some(skip); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn is_key_vault_refresh_failed(mut self, is_key_vault_refresh_failed: bool) -> Self { + self.is_key_vault_refresh_failed = Some(is_key_vault_refresh_failed); + 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/{}/notifications", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -14147,12 +22496,19 @@ pub mod notification { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + 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()); } + if let Some(is_key_vault_refresh_failed) = &self.is_key_vault_refresh_failed { + url.query_pairs_mut() + .append_pair("isKeyVaultRefreshFailed", &is_key_vault_refresh_failed.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)?; @@ -14161,7 +22517,7 @@ pub mod notification { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NotificationCollection = + let rsp_value: models::NamedValueCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -14208,19 +22564,19 @@ pub mod notification { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, + pub(crate) named_value_id: String, 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.ApiManagement/service/{}/notifications/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.notification_name + &self.named_value_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -14240,7 +22596,7 @@ pub mod notification { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NotificationContract = + let rsp_value: models::NamedValueContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -14260,6 +22616,12 @@ pub mod notification { } pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Created201(models::NamedValueContract), + Ok200(models::NamedValueContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -14287,7 +22649,8 @@ pub mod notification { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, + pub(crate) named_value_id: String, + pub(crate) parameters: models::NamedValueCreateContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -14296,15 +22659,15 @@ pub mod notification { self.if_match = Some(if_match.into()); self } - 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.ApiManagement/service/{}/notifications/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.notification_name + &self.named_value_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -14316,164 +22679,28 @@ pub mod notification { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NotificationContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::CREATED => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ErrorResponse = + let rsp_value: models::NamedValueContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) + Ok(Response::Created201(rsp_value)) } - } - }) - } - } - } -} -pub mod notification_recipient_user { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_notification( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - subscription_id: impl Into, - ) -> list_by_notification::Builder { - list_by_notification::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - notification_name: notification_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - user_id: 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(), - notification_name: notification_name.into(), - user_id: user_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - user_id: 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(), - notification_name: notification_name.into(), - user_id: user_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn check_entity_exists( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - user_id: impl Into, - subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - notification_name: notification_name.into(), - user_id: user_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_notification { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) notification_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.ApiManagement/service/{}/notifications/{}/recipientUsers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientUserCollection = + let rsp_value: models::NamedValueContract = 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)?; @@ -14489,12 +22716,12 @@ pub mod notification_recipient_user { } } } - pub mod create_or_update { + pub mod update { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::RecipientUserContract), - Ok200(models::RecipientUserContract), + Accepted202, + Ok200(models::NamedValueContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14523,17 +22750,25 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) user_id: String, + pub(crate) named_value_id: String, + pub(crate) parameters: models::NamedValueUpdateParameters, + 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/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14541,21 +22776,18 @@ pub mod notification_recipient_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::RecipientUserContract = - 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), http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientUserContract = + let rsp_value: models::NamedValueContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -14607,14 +22839,21 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) user_id: String, + pub(crate) named_value_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/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_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); @@ -14625,6 +22864,7 @@ pub mod notification_recipient_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + 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)?; @@ -14647,12 +22887,10 @@ pub mod notification_recipient_user { } } } - pub mod check_entity_exists { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Error response #response_type")] - NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -14678,14 +22916,20 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) user_id: String, + pub(crate) named_value_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/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_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); @@ -14702,8 +22946,7 @@ pub mod notification_recipient_user { let 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(()), - http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + 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 = @@ -14718,79 +22961,7 @@ pub mod notification_recipient_user { } } } -} -pub mod notification_recipient_email { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_notification( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - subscription_id: impl Into, - ) -> list_by_notification::Builder { - list_by_notification::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - notification_name: notification_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - email: 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(), - notification_name: notification_name.into(), - email: email.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - email: 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(), - notification_name: notification_name.into(), - email: email.into(), - subscription_id: subscription_id.into(), - } - } - pub fn check_entity_exists( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - email: impl Into, - subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - notification_name: notification_name.into(), - email: email.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_notification { + pub mod list_value { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14819,16 +22990,23 @@ pub mod notification_recipient_email { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, + pub(crate) named_value_id: String, 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.ApiManagement/service/{}/notifications/{}/recipientEmails" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}/listValue", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14837,6 +23015,7 @@ pub mod notification_recipient_email { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); 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)?; @@ -14844,7 +23023,7 @@ pub mod notification_recipient_email { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientEmailCollection = + let rsp_value: models::NamedValueSecretContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -14862,12 +23041,12 @@ pub mod notification_recipient_email { } } } - pub mod create_or_update { + pub mod refresh_secret { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::RecipientEmailContract), - Ok200(models::RecipientEmailContract), + Accepted202, + Ok200(models::NamedValueContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14896,17 +23075,23 @@ pub mod notification_recipient_email { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) email: String, + pub(crate) named_value_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/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}/refreshSecret", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14915,20 +23100,16 @@ pub mod notification_recipient_email { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientEmailContract = - 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), http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientEmailContract = + let rsp_value: models::NamedValueContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -14946,13 +23127,42 @@ pub mod notification_recipient_email { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, +} +pub mod network_status { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> list_by_service::Builder { + list_by_service::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_by_location( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + location_name: impl Into, + ) -> list_by_location::Builder { + list_by_location::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + location_name: location_name.into(), + } } + } + pub mod list_by_service { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -14978,19 +23188,25 @@ pub mod notification_recipient_email { #[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) notification_name: String, - pub(crate) email: String, - 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, Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/networkstatus", + 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15004,8 +23220,12 @@ pub mod notification_recipient_email { let rsp = 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::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::ErrorResponse = @@ -15020,12 +23240,10 @@ pub mod notification_recipient_email { } } } - pub mod check_entity_exists { + pub mod list_by_location { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Error response #response_type")] - NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -15049,19 +23267,25 @@ pub mod notification_recipient_email { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) email: String, pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) location_name: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/locations/{}/networkstatus", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.location_name + ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15075,8 +23299,12 @@ pub mod notification_recipient_email { let 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(()), - http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkStatusContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -15092,7 +23320,7 @@ pub mod notification_recipient_email { } } } -pub mod open_id_connect_provider { +pub mod notification { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -15107,7 +23335,6 @@ pub mod open_id_connect_provider { resource_group_name: resource_group_name.into(), service_name: service_name.into(), subscription_id: subscription_id.into(), - filter: None, top: None, skip: None, } @@ -15116,14 +23343,14 @@ pub mod open_id_connect_provider { &self, resource_group_name: impl Into, service_name: impl Into, - opid: impl Into, + notification_name: 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(), - opid: opid.into(), + notification_name: notification_name.into(), subscription_id: subscription_id.into(), } } @@ -15131,86 +23358,18 @@ pub mod open_id_connect_provider { &self, resource_group_name: impl Into, service_name: impl Into, - opid: impl Into, - parameters: impl Into, + notification_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(), service_name: service_name.into(), - opid: opid.into(), - parameters: parameters.into(), + notification_name: notification_name.into(), subscription_id: subscription_id.into(), if_match: None, } } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - opid: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - opid: opid.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - opid: 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(), - opid: opid.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, - opid: 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(), - opid: opid.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_secrets( - &self, - resource_group_name: impl Into, - service_name: impl Into, - opid: impl Into, - subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - opid: opid.into(), - subscription_id: subscription_id.into(), - } - } } pub mod list_by_service { use super::models; @@ -15242,15 +23401,10 @@ pub mod open_id_connect_provider { 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 @@ -15259,12 +23413,10 @@ pub mod open_id_connect_provider { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/openidConnectProviders", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -15280,9 +23432,6 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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()); } @@ -15297,7 +23446,7 @@ pub mod open_id_connect_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OpenIdConnectProviderCollection = + let rsp_value: models::NotificationCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -15344,21 +23493,19 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, + pub(crate) notification_name: String, 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.ApiManagement/service/{}/openidConnectProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.opid + &self.notification_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -15378,7 +23525,7 @@ pub mod open_id_connect_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OpenidConnectProviderContract = + let rsp_value: models::NotificationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -15398,11 +23545,6 @@ pub mod open_id_connect_provider { } pub mod create_or_update { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::OpenidConnectProviderContract), - Ok200(models::OpenidConnectProviderContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15430,8 +23572,7 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, - pub(crate) parameters: models::OpenidConnectProviderContract, + pub(crate) notification_name: String, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -15440,15 +23581,15 @@ pub mod open_id_connect_provider { self.if_match = Some(if_match.into()); self } - 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.ApiManagement/service/{}/openidConnectProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.opid + &self.notification_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -15460,27 +23601,20 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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); } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::OpenidConnectProviderContract = - 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::OpenidConnectProviderContract = + let rsp_value: models::NotificationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -15496,7 +23630,79 @@ pub mod open_id_connect_provider { } } } - pub mod update { +} +pub mod notification_recipient_user { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_notification( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + subscription_id: impl Into, + ) -> list_by_notification::Builder { + list_by_notification::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + user_id: 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(), + notification_name: notification_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + user_id: 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(), + notification_name: notification_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_notification { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -15525,27 +23731,16 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, - pub(crate) parameters: models::OpenidConnectProviderUpdateContract, - pub(crate) if_match: String, + pub(crate) notification_name: String, 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.ApiManagement/service/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15553,9 +23748,7 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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.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)?; @@ -15563,7 +23756,7 @@ pub mod open_id_connect_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OpenidConnectProviderContract = + let rsp_value: models::RecipientUserCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -15581,12 +23774,12 @@ pub mod open_id_connect_provider { } } } - pub mod delete { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200, - NoContent204, + Created201(models::RecipientUserContract), + Ok200(models::RecipientUserContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -15615,24 +23808,17 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, - pub(crate) if_match: String, + pub(crate) notification_name: String, + pub(crate) user_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/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15640,15 +23826,24 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecipientUserContract = + 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::RecipientUserContract = + 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 = @@ -15663,8 +23858,13 @@ pub mod open_id_connect_provider { } } } - pub mod get_entity_tag { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15692,23 +23892,17 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, + pub(crate) notification_name: String, + pub(crate) user_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15722,7 +23916,8 @@ pub mod open_id_connect_provider { let rsp = 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(()), + 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 = @@ -15737,10 +23932,12 @@ pub mod open_id_connect_provider { } } } - pub mod list_secrets { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -15766,16 +23963,17 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, + pub(crate) notification_name: String, + pub(crate) user_id: String, 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<(), Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . opid) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15784,18 +23982,13 @@ pub mod open_id_connect_provider { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); 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::ClientSecretContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + http::StatusCode::NO_CONTENT => Ok(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -15811,91 +24004,78 @@ pub mod open_id_connect_provider { } } } -pub mod policy { +pub mod notification_recipient_email { use super::models; 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(), - } - } - pub fn get( + pub fn list_by_notification( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, + notification_name: impl Into, subscription_id: impl Into, - ) -> get::Builder { - get::Builder { + ) -> list_by_notification::Builder { + list_by_notification::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - policy_id: policy_id.into(), + notification_name: notification_name.into(), subscription_id: subscription_id.into(), - format: None, } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, - parameters: impl Into, + notification_name: impl Into, + email: 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(), - policy_id: policy_id.into(), - parameters: parameters.into(), + notification_name: notification_name.into(), + email: email.into(), subscription_id: subscription_id.into(), - if_match: None, } } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, - if_match: impl Into, + notification_name: impl Into, + email: 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(), - policy_id: policy_id.into(), - if_match: if_match.into(), + notification_name: notification_name.into(), + email: email.into(), subscription_id: subscription_id.into(), } } - pub fn get_entity_tag( + pub fn check_entity_exists( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, + notification_name: impl Into, + email: impl Into, subscription_id: impl Into, - ) -> get_entity_tag::Builder { - get_entity_tag::Builder { + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - policy_id: policy_id.into(), + notification_name: notification_name.into(), + email: email.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_service { + pub mod list_by_notification { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -15924,18 +24104,13 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) notification_name: String, 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.ApiManagement/service/{}/policies", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::GET); @@ -15954,7 +24129,7 @@ pub mod policy { match 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 = + let rsp_value: models::RecipientEmailCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -15972,8 +24147,13 @@ pub mod policy { } } } - pub mod get { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::RecipientEmailContract), + Ok200(models::RecipientEmailContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -16001,28 +24181,101 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, + pub(crate) notification_name: String, + pub(crate) email: String, pub(crate) subscription_id: String, - pub(crate) format: Option, } impl Builder { - pub fn format(mut self, format: impl Into) -> Self { - self.format = Some(format.into()); - self - } - 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.ApiManagement/service/{}/policies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.policy_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let mut url = 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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::RecipientEmailContract = + 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::RecipientEmailContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) notification_name: String, + pub(crate) email: 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/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16030,21 +24283,14 @@ pub mod policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - if let Some(format) = &self.format { - url.query_pairs_mut().append_pair("format", format); - } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PolicyContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -16059,15 +24305,12 @@ pub mod policy { } } } - pub mod create_or_update { + pub mod check_entity_exists { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::PolicyContract), - Ok200(models::PolicyContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -16093,29 +24336,17 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, - pub(crate) parameters: models::PolicyContract, + pub(crate) notification_name: String, + pub(crate) email: String, 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> { + 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/{}/policies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.policy_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; let mut url = 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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16123,28 +24354,14 @@ pub mod policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::PolicyContract = - 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::PolicyContract = - 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(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -16159,13 +24376,129 @@ pub mod policy { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, +} +pub mod open_id_connect_provider { + use super::models; + 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, + opid: 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(), + opid: opid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: 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(), + opid: opid.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + opid: opid.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: 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(), + opid: opid.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, + opid: 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(), + opid: opid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + opid: opid.into(), + subscription_id: subscription_id.into(), + } } + } + pub mod list_by_service { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -16193,24 +24526,38 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, - pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.policy_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16218,15 +24565,27 @@ pub mod policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - req_builder = req_builder.header("If-Match", &self.if_match); + 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 => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenIdConnectProviderCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -16241,7 +24600,7 @@ pub mod policy { } } } - pub mod get_entity_tag { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -16270,23 +24629,25 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, + pub(crate) opid: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.policy_id + &self.opid ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16300,7 +24661,12 @@ pub mod policy { let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenidConnectProviderContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -16315,28 +24681,13 @@ pub mod policy { } } } -} -pub mod policy_description { - use super::models; - 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(), - scope: None, - } - } - } - pub mod list_by_service { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::OpenidConnectProviderContract), + Ok200(models::OpenidConnectProviderContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -16364,28 +24715,29 @@ pub mod policy_description { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) opid: String, + pub(crate) parameters: models::OpenidConnectProviderContract, pub(crate) subscription_id: String, - pub(crate) scope: Option, + pub(crate) if_match: Option, } impl Builder { - pub fn scope(mut self, scope: impl Into) -> Self { - self.scope = Some(scope.into()); + 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> { + 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/{}/policyDescriptions", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.opid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16393,20 +24745,27 @@ pub mod policy_description { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - if let Some(scope) = &self.scope { - url.query_pairs_mut().append_pair("scope", scope); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::OpenidConnectProviderContract = + 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::PolicyDescriptionCollection = + let rsp_value: models::OpenidConnectProviderContract = 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)?; @@ -16422,95 +24781,7 @@ pub mod policy_description { } } } -} -pub mod portal_revision { - use super::models; - 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, - portal_revision_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(), - portal_revision_id: portal_revision_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - portal_revision_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(), - portal_revision_id: portal_revision_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - portal_revision_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - portal_revision_id: portal_revision_id.into(), - parameters: parameters.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, - portal_revision_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(), - portal_revision_id: portal_revision_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -16539,36 +24810,27 @@ pub mod portal_revision { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) opid: String, + pub(crate) parameters: models::OpenidConnectProviderUpdateContract, + pub(crate) if_match: 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> { + 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/{}/portalRevisions", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.opid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16576,16 +24838,9 @@ pub mod portal_revision { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.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)?; @@ -16593,7 +24848,7 @@ pub mod portal_revision { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalRevisionCollection = + let rsp_value: models::OpenidConnectProviderContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -16611,8 +24866,13 @@ pub mod portal_revision { } } } - pub mod get { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -16640,23 +24900,24 @@ pub mod portal_revision { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) portal_revision_id: String, + pub(crate) opid: 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> { + 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/{}/portalRevisions/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.portal_revision_id + &self.opid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16664,18 +24925,15 @@ pub mod portal_revision { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalRevisionContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -16690,13 +24948,8 @@ pub mod portal_revision { } } } - pub mod create_or_update { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Created201(models::PortalRevisionContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -16724,45 +24977,37 @@ pub mod portal_revision { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) portal_revision_id: String, - pub(crate) parameters: models::PortalRevisionContract, + pub(crate) opid: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.portal_revision_id + &self.opid ); let mut url = 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); + 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", "2021-01-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalRevisionContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Created201(rsp_value)) - } + 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 = @@ -16777,13 +25022,8 @@ pub mod portal_revision { } } } - pub mod update { + pub mod list_secrets { use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Ok200(models::PortalRevisionContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -16811,25 +25051,16 @@ pub mod portal_revision { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) portal_revision_id: String, - pub(crate) parameters: models::PortalRevisionContract, - pub(crate) if_match: String, + pub(crate) opid: String, 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.ApiManagement/service/{}/portalRevisions/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.portal_revision_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . opid) ; let mut url = 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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16837,20 +25068,18 @@ pub mod portal_revision { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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.header("If-Match", &self.if_match); + 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::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalRevisionContract = + let rsp_value: models::ClientSecretContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -16866,7 +25095,92 @@ pub mod portal_revision { } } } - pub mod get_entity_tag { +} +pub mod policy { + use super::models; + 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(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + policy_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(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + format: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + policy_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(), + policy_id: policy_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, + policy_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(), + policy_id: policy_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, + policy_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(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -16895,23 +25209,21 @@ pub mod portal_revision { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) portal_revision_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/portalRevisions/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.portal_revision_id + &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::HEAD); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16925,7 +25237,12 @@ pub mod portal_revision { let rsp = 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(()), + 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)?; let rsp_value: models::ErrorResponse = @@ -16940,26 +25257,7 @@ pub mod portal_revision { } } } -} -pub mod portal_settings { - use super::models; - 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(), - } - } - } - pub mod list_by_service { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -16988,17 +25286,24 @@ pub mod portal_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) policy_id: String, pub(crate) subscription_id: String, + pub(crate) format: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.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/{}/portalsettings", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -17010,6 +25315,9 @@ pub mod portal_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -17018,7 +25326,7 @@ pub mod portal_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSettingsCollection = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -17036,73 +25344,13 @@ pub mod portal_settings { } } } -} -pub mod sign_in_settings { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - resource_group_name: impl Into, - service_name: 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(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - 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(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - parameters: parameters.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, - 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(), - subscription_id: subscription_id.into(), - } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), } - } - pub mod get { - use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -17130,21 +25378,29 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17152,17 +25408,27 @@ pub mod sign_in_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::PolicyContract = + 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::PortalSigninSettings = + let rsp_value: models::PolicyContract = 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)?; @@ -17178,8 +25444,13 @@ pub mod sign_in_settings { } } } - pub mod create_or_update { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -17207,27 +25478,24 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSigninSettings, + pub(crate) policy_id: String, + pub(crate) if_match: String, 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> { + 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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17235,22 +25503,15 @@ pub mod sign_in_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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.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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSigninSettings = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -17265,7 +25526,7 @@ pub mod sign_in_settings { } } } - pub mod update { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17294,23 +25555,23 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSigninSettings, - pub(crate) if_match: String, + pub(crate) policy_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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17318,15 +25579,13 @@ pub mod sign_in_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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.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::NO_CONTENT => Ok(()), + 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 = @@ -17341,7 +25600,27 @@ pub mod sign_in_settings { } } } - pub mod get_entity_tag { +} +pub mod policy_description { + use super::models; + 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(), + scope: None, + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17371,12 +25650,19 @@ pub mod sign_in_settings { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) subscription_id: String, + pub(crate) scope: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + pub fn scope(mut self, scope: impl Into) -> Self { + self.scope = Some(scope.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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policyDescriptions", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -17384,7 +25670,7 @@ pub mod sign_in_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17392,13 +25678,21 @@ pub mod sign_in_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + if let Some(scope) = &self.scope { + url.query_pairs_mut().append_pair("scope", scope); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyDescriptionCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -17414,20 +25708,38 @@ pub mod sign_in_settings { } } } -pub mod sign_up_settings { +pub mod portal_revision { use super::models; 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, + portal_revision_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(), + portal_revision_id: portal_revision_id.into(), subscription_id: subscription_id.into(), } } @@ -17435,23 +25747,25 @@ pub mod sign_up_settings { &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + portal_revision_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(), + portal_revision_id: portal_revision_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), - if_match: None, } } pub fn update( &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + portal_revision_id: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -17459,6 +25773,7 @@ pub mod sign_up_settings { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + portal_revision_id: portal_revision_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), @@ -17468,16 +25783,119 @@ pub mod sign_up_settings { &self, resource_group_name: impl Into, service_name: impl Into, + portal_revision_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(), + portal_revision_id: portal_revision_id.into(), subscription_id: subscription_id.into(), } } } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/portalRevisions", + 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", "2021-01-01-preview"); + 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::PortalRevisionCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; #[derive(Debug, thiserror :: Error)] @@ -17507,17 +25925,19 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) portal_revision_id: String, 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.ApiManagement/service/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.portal_revision_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -17537,7 +25957,7 @@ pub mod sign_up_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSignupSettings = + let rsp_value: models::PortalRevisionContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -17557,6 +25977,11 @@ pub mod sign_up_settings { } pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Created201(models::PortalRevisionContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -17584,23 +26009,20 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSignupSettings, + pub(crate) portal_revision_id: String, + pub(crate) parameters: models::PortalRevisionContract, 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> { + 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/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.portal_revision_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -17614,19 +26036,17 @@ pub mod sign_up_settings { url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); 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::OK => { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::CREATED => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSignupSettings = + let rsp_value: models::PortalRevisionContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + Ok(Response::Created201(rsp_value)) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -17644,6 +26064,11 @@ pub mod sign_up_settings { } pub mod update { use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::PortalRevisionContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -17671,19 +26096,21 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSignupSettings, + pub(crate) portal_revision_id: String, + pub(crate) parameters: models::PortalRevisionContract, pub(crate) if_match: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.portal_revision_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -17703,7 +26130,13 @@ pub mod sign_up_settings { let 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(()), + 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::PortalRevisionContract = + 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 = @@ -17747,17 +26180,19 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) portal_revision_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/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.portal_revision_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -17791,76 +26226,17 @@ pub mod sign_up_settings { } } } -pub mod delegation_settings { +pub mod portal_settings { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn get( - &self, - resource_group_name: impl Into, - service_name: 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(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - 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(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - parameters: parameters.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, - 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(), - subscription_id: subscription_id.into(), - } - } - pub fn list_secrets( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), @@ -17868,7 +26244,7 @@ pub mod delegation_settings { } } } - pub mod get { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17900,10 +26276,10 @@ pub mod delegation_settings { 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.ApiManagement/service/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -17927,7 +26303,7 @@ pub mod delegation_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalDelegationSettings = + let rsp_value: models::PortalSettingsCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -17945,7 +26321,72 @@ pub mod delegation_settings { } } } - pub mod create_or_update { +} +pub mod sign_in_settings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + service_name: 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(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + 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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.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, + 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(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17974,19 +26415,13 @@ pub mod delegation_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalDelegationSettings, 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> { + 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/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -17994,7 +26429,7 @@ pub mod delegation_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18002,11 +26437,7 @@ pub mod delegation_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -18014,7 +26445,7 @@ pub mod delegation_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalDelegationSettings = + let rsp_value: models::PortalSigninSettings = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -18032,7 +26463,7 @@ pub mod delegation_settings { } } } - pub mod update { + pub mod create_or_update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18061,15 +26492,19 @@ pub mod delegation_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalDelegationSettings, - pub(crate) if_match: String, + pub(crate) parameters: models::PortalSigninSettings, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -18077,7 +26512,7 @@ pub mod delegation_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18087,13 +26522,20 @@ pub mod delegation_settings { url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); 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.header("If-Match", &self.if_match); + 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::NO_CONTENT => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalSigninSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -18108,7 +26550,7 @@ pub mod delegation_settings { } } } - pub mod get_entity_tag { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18137,13 +26579,15 @@ pub mod delegation_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) parameters: models::PortalSigninSettings, + pub(crate) if_match: 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/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -18151,7 +26595,7 @@ pub mod delegation_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18159,13 +26603,15 @@ pub mod delegation_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => Ok(()), + 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::ErrorResponse = @@ -18180,7 +26626,7 @@ pub mod delegation_settings { } } } - pub mod list_secrets { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18212,14 +26658,18 @@ pub mod delegation_settings { 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<(), Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", + 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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18228,18 +26678,12 @@ pub mod delegation_settings { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); 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::PortalSettingValidationKeyContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -18255,40 +26699,20 @@ pub mod delegation_settings { } } } -pub mod product { +pub mod sign_up_settings { use super::models; 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, - expand_groups: None, - tags: None, - } - } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - product_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(), - product_id: product_id.into(), subscription_id: subscription_id.into(), } } @@ -18296,15 +26720,13 @@ pub mod product { &self, resource_group_name: impl Into, service_name: impl Into, - product_id: impl Into, - parameters: 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(), - product_id: product_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -18314,8 +26736,7 @@ pub mod product { &self, resource_group_name: impl Into, service_name: impl Into, - product_id: impl Into, - parameters: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -18323,64 +26744,190 @@ pub mod product { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - product_id: product_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_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(), - product_id: product_id.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - delete_subscriptions: None, - } - } pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, - product_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(), - product_id: product_id.into(), subscription_id: subscription_id.into(), } } - pub fn list_by_tags( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> list_by_tags::Builder { - list_by_tags::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, - include_not_tagged_products: None, + } + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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, + } + impl Builder { + 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/{}/portalsettings/signup", + 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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalSignupSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) parameters: models::PortalSignupSettings, + 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/{}/portalsettings/signup", + 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", "2021-01-01-preview"); + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalSignupSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_service { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18409,38 +26956,15 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) parameters: models::PortalSignupSettings, + pub(crate) if_match: String, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, - pub(crate) expand_groups: Option, - pub(crate) tags: 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 expand_groups(mut self, expand_groups: bool) -> Self { - self.expand_groups = Some(expand_groups); - self - } - pub fn tags(mut self, tags: impl Into) -> Self { - self.tags = Some(tags.into()); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/products", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -18448,7 +26972,7 @@ pub mod product { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18456,33 +26980,15 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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()); - } - if let Some(expand_groups) = &self.expand_groups { - url.query_pairs_mut().append_pair("expandGroups", &expand_groups.to_string()); - } - if let Some(tags) = &self.tags { - url.query_pairs_mut().append_pair("tags", tags); - } - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProductCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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::ErrorResponse = @@ -18497,7 +27003,7 @@ pub mod product { } } } - pub mod get { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18526,23 +27032,21 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18556,12 +27060,7 @@ pub mod product { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProductContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -18576,13 +27075,86 @@ pub mod product { } } } - pub mod create_or_update { - use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ProductContract), - Ok200(models::ProductContract), +} +pub mod delegation_settings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + service_name: 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(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + 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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.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, + 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(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -18610,29 +27182,21 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) parameters: models::ProductContract, 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> { + 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18640,27 +27204,17 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ProductContract = - 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::ProductContract = + let rsp_value: models::PortalDelegationSettings = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -18676,7 +27230,7 @@ pub mod product { } } } - pub mod update { + pub mod create_or_update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18705,25 +27259,27 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) parameters: models::ProductUpdateParameters, - pub(crate) if_match: String, + pub(crate) parameters: models::PortalDelegationSettings, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18733,7 +27289,9 @@ pub mod product { url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); 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.header("If-Match", &self.if_match); + 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)?; @@ -18741,7 +27299,7 @@ pub mod product { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProductContract = + let rsp_value: models::PortalDelegationSettings = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -18759,13 +27317,8 @@ pub mod product { } } } - pub mod delete { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -18793,29 +27346,23 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, + pub(crate) parameters: models::PortalDelegationSettings, pub(crate) if_match: String, pub(crate) subscription_id: String, - pub(crate) delete_subscriptions: Option, } impl Builder { - pub fn delete_subscriptions(mut self, delete_subscriptions: bool) -> Self { - self.delete_subscriptions = Some(delete_subscriptions); - self - } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18823,19 +27370,15 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + 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.header("If-Match", &self.if_match); - if let Some(delete_subscriptions) = &self.delete_subscriptions { - url.query_pairs_mut() - .append_pair("deleteSubscriptions", &delete_subscriptions.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::NO_CONTENT => Ok(Response::NoContent204), + 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::ErrorResponse = @@ -18879,19 +27422,17 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &self.service_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -18924,7 +27465,7 @@ pub mod product { } } } - pub mod list_by_tags { + pub mod list_secrets { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18954,40 +27495,16 @@ pub mod product { 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, - pub(crate) include_not_tagged_products: 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 include_not_tagged_products(mut self, include_not_tagged_products: bool) -> Self { - self.include_not_tagged_products = Some(include_not_tagged_products); - self - } - 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.ApiManagement/service/{}/productsByTags", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation/listSecrets" , 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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18995,20 +27512,8 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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()); - } - if let Some(include_not_tagged_products) = &self.include_not_tagged_products { - url.query_pairs_mut() - .append_pair("includeNotTaggedProducts", &include_not_tagged_products.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)?; @@ -19016,7 +27521,7 @@ pub mod product { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagResourceCollection = + let rsp_value: models::PortalSettingValidationKeyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -19035,26 +27540,41 @@ pub mod product { } } } -pub mod product_api { +pub mod product { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_product( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - product_id: impl Into, subscription_id: impl Into, - ) -> list_by_product::Builder { - list_by_product::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - product_id: product_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, + expand_groups: None, + tags: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_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(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), } } pub fn create_or_update( @@ -19062,7 +27582,7 @@ pub mod product_api { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - api_id: impl Into, + parameters: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -19070,7 +27590,27 @@ pub mod product_api { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - api_id: api_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } @@ -19079,7 +27619,7 @@ pub mod product_api { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - api_id: impl Into, + if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { delete::Builder { @@ -19087,138 +27627,46 @@ pub mod product_api { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - api_id: api_id.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), + delete_subscriptions: None, } } - pub fn check_entity_exists( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - api_id: impl Into, subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - api_id: api_id.into(), subscription_id: subscription_id.into(), } } - } - pub mod list_by_product { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: 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/{}/products/{}/apis", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_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", "2021-01-01-preview"); - 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::ApiCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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 list_by_tags( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_tags::Builder { + list_by_tags::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, + include_not_tagged_products: None, } } } - pub mod create_or_update { + pub mod list_by_service { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ApiContract), - Ok200(models::ApiContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -19246,25 +27694,46 @@ pub mod product_api { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) api_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) expand_groups: Option, + pub(crate) tags: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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 expand_groups(mut self, expand_groups: bool) -> Self { + self.expand_groups = Some(expand_groups); + self + } + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.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/{}/products/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.api_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -19272,106 +27741,33 @@ pub mod product_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + 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()); + } + if let Some(expand_groups) = &self.expand_groups { + url.query_pairs_mut().append_pair("expandGroups", &expand_groups.to_string()); + } + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ApiContract = - 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::ApiContract = - 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 = + let rsp_value: models::ProductCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) + Ok(rsp_value) } - } - }) - } - } - } - pub mod delete { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: String, - pub(crate) api_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/{}/products/{}/apis/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.api_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", "2021-01-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = 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 = @@ -19386,7 +27782,7 @@ pub mod product_api { } } } - pub mod check_entity_exists { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -19416,24 +27812,22 @@ pub mod product_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) api_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/products/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.api_id + &self.product_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -19447,98 +27841,33 @@ pub mod product_api { let 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 => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ErrorResponse = + let rsp_value: models::ProductContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) + Ok(rsp_value) } - } - }) - } - } - } -} -pub mod product_group { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - subscription_id: impl Into, - ) -> list_by_product::Builder { - list_by_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - group_id: 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(), - product_id: product_id.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - group_id: 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(), - product_id: product_id.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn check_entity_exists( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - group_id: impl Into, - subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), + 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_product { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ProductContract), + Ok200(models::ProductContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -19567,28 +27896,19 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, + pub(crate) parameters: models::ProductContract, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, + pub(crate) if_match: 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); + 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> { + 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/{}/products/{}/groups", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -19597,7 +27917,7 @@ pub mod product_group { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -19605,26 +27925,27 @@ pub mod product_group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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()); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ProductContract = + 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::GroupCollection = + let rsp_value: models::ProductContract = 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)?; @@ -19640,13 +27961,8 @@ pub mod product_group { } } } - pub mod create_or_update { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::GroupContract), - Ok200(models::GroupContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -19675,24 +27991,24 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) group_id: String, + pub(crate) parameters: models::ProductUpdateParameters, + pub(crate) if_match: String, 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.ApiManagement/service/{}/products/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.group_id + &self.product_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -19700,23 +28016,19 @@ pub mod product_group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::GroupContract = - 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::GroupContract = + let rsp_value: models::ProductContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -19767,20 +28079,24 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) group_id: String, + pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) delete_subscriptions: Option, } impl Builder { + pub fn delete_subscriptions(mut self, delete_subscriptions: bool) -> Self { + self.delete_subscriptions = Some(delete_subscriptions); + 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/{}/products/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.group_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -19792,6 +28108,11 @@ pub mod product_group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + if let Some(delete_subscriptions) = &self.delete_subscriptions { + url.query_pairs_mut() + .append_pair("deleteSubscriptions", &delete_subscriptions.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)?; @@ -19814,7 +28135,7 @@ pub mod product_group { } } } - pub mod check_entity_exists { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -19844,20 +28165,18 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) group_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/{}/products/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.group_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -19875,7 +28194,7 @@ pub mod product_group { let 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(()), + 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 = @@ -19890,31 +28209,7 @@ pub mod product_group { } } } -} -pub mod product_subscriptions { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - } - pub mod list { + pub mod list_by_tags { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -19943,11 +28238,11 @@ pub mod product_subscriptions { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, + pub(crate) include_not_tagged_products: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -19962,15 +28257,18 @@ pub mod product_subscriptions { self.skip = Some(skip); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn include_not_tagged_products(mut self, include_not_tagged_products: bool) -> Self { + self.include_not_tagged_products = Some(include_not_tagged_products); + 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/{}/products/{}/subscriptions", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/productsByTags", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &self.service_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -19991,6 +28289,10 @@ pub mod product_subscriptions { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } + if let Some(include_not_tagged_products) = &self.include_not_tagged_products { + url.query_pairs_mut() + .append_pair("includeNotTaggedProducts", &include_not_tagged_products.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)?; @@ -19999,7 +28301,7 @@ pub mod product_subscriptions { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::SubscriptionCollection = + let rsp_value: models::TagResourceCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -20018,7 +28320,7 @@ pub mod product_subscriptions { } } } -pub mod product_policy { +pub mod product_api { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -20035,24 +28337,9 @@ pub mod product_policy { service_name: service_name.into(), product_id: product_id.into(), subscription_id: subscription_id.into(), - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - policy_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(), - product_id: product_id.into(), - policy_id: policy_id.into(), - subscription_id: subscription_id.into(), - format: None, + filter: None, + top: None, + skip: None, } } pub fn create_or_update( @@ -20060,8 +28347,7 @@ pub mod product_policy { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - policy_id: impl Into, - parameters: impl Into, + api_id: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -20069,10 +28355,8 @@ pub mod product_policy { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - policy_id: policy_id.into(), - parameters: parameters.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), - if_match: None, } } pub fn delete( @@ -20080,8 +28364,7 @@ pub mod product_policy { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - policy_id: impl Into, - if_match: impl Into, + api_id: impl Into, subscription_id: impl Into, ) -> delete::Builder { delete::Builder { @@ -20089,109 +28372,29 @@ pub mod product_policy { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - policy_id: policy_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, - product_id: impl Into, - policy_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(), - product_id: product_id.into(), - policy_id: policy_id.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_product { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_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/{}/products/{}/policies", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_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", "2021-01-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match 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)?; - 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 check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), } } } - pub mod get { + pub mod list_by_product { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -20221,25 +28424,33 @@ pub mod product_policy { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) policy_id: String, pub(crate) subscription_id: String, - pub(crate) format: Option, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn format(mut self, format: impl Into) -> Self { - self.format = Some(format.into()); + 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> { + 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/{}/products/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.policy_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -20251,8 +28462,14 @@ pub mod product_policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - if let Some(format) = &self.format { - url.query_pairs_mut().append_pair("format", format); + 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()); @@ -20262,7 +28479,7 @@ pub mod product_policy { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PolicyContract = + let rsp_value: models::ApiCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -20284,8 +28501,8 @@ pub mod product_policy { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::PolicyContract), - Ok200(models::PolicyContract), + Created201(models::ApiContract), + Ok200(models::ApiContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -20315,26 +28532,20 @@ pub mod product_policy { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) policy_id: String, - pub(crate) parameters: models::PolicyContract, + pub(crate) api_id: String, 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/{}/products/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.policy_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -20346,11 +28557,7 @@ pub mod product_policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - if let Some(if_match) = &self.if_match { - req_builder = req_builder.header("If-Match", if_match); - } - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -20358,13 +28565,13 @@ pub mod product_policy { 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::PolicyContract = + let rsp_value: models::ApiContract = 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::PolicyContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -20417,21 +28624,20 @@ pub mod product_policy { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) policy_id: String, - pub(crate) if_match: String, + pub(crate) api_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/{}/products/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.policy_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -20443,7 +28649,6 @@ pub mod product_policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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)?; @@ -20466,7 +28671,7 @@ pub mod product_policy { } } } - pub mod get_entity_tag { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -20492,213 +28697,93 @@ pub mod product_policy { } #[derive(Clone)] pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) policy_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/{}/products/{}/policies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.policy_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", "2021-01-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = 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 tag { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - subscription_id: impl Into, - ) -> list_by_product::Builder { - list_by_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - pub fn get_by_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - tag_id: impl Into, - subscription_id: impl Into, - ) -> get_by_product::Builder { - get_by_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn assign_to_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - tag_id: impl Into, - subscription_id: impl Into, - ) -> assign_to_product::Builder { - assign_to_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn detach_from_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - tag_id: impl Into, - subscription_id: impl Into, - ) -> detach_from_product::Builder { - detach_from_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) api_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/{}/products/{}/apis/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.api_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", "2021-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::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 get_entity_state_by_product( + } +} +pub mod product_group { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_product( &self, resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - tag_id: impl Into, subscription_id: impl Into, - ) -> get_entity_state_by_product::Builder { - get_entity_state_by_product::Builder { + ) -> list_by_product::Builder { + list_by_product::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), - } - } - 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, - scope: None, - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - tag_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(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - tag_id: impl Into, - parameters: impl Into, + product_id: impl Into, + group_id: 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(), - tag_id: tag_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - tag_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - tag_id: tag_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), + product_id: product_id.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -20706,31 +28791,33 @@ pub mod tag { &self, resource_group_name: impl Into, service_name: impl Into, - tag_id: impl Into, - if_match: impl Into, + product_id: impl Into, + group_id: 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(), - tag_id: tag_id.into(), - if_match: if_match.into(), + product_id: product_id.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } - pub fn get_entity_state( + pub fn check_entity_exists( &self, resource_group_name: impl Into, service_name: impl Into, - tag_id: impl Into, + product_id: impl Into, + group_id: impl Into, subscription_id: impl Into, - ) -> get_entity_state::Builder { - get_entity_state::Builder { + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - tag_id: tag_id.into(), + product_id: product_id.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -20783,10 +28870,10 @@ pub mod tag { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/products/{}/tags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -20820,88 +28907,7 @@ pub mod tag { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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_product { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: String, - pub(crate) tag_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/{}/products/{}/tags/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.tag_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", "2021-01-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagContract = + let rsp_value: models::GroupCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -20919,12 +28925,12 @@ pub mod tag { } } } - pub mod assign_to_product { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::TagContract), - Ok200(models::TagContract), + Created201(models::GroupContract), + Ok200(models::GroupContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -20954,20 +28960,20 @@ pub mod tag { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) tag_id: String, + pub(crate) group_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/{}/products/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.tag_id + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -20987,13 +28993,13 @@ pub mod tag { 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::TagContract = + let rsp_value: models::GroupContract = 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::TagContract = + let rsp_value: models::GroupContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -21011,7 +29017,7 @@ pub mod tag { } } } - pub mod detach_from_product { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { @@ -21046,20 +29052,20 @@ pub mod tag { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) tag_id: String, + pub(crate) group_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/{}/products/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.tag_id + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -21093,7 +29099,7 @@ pub mod tag { } } } - pub mod get_entity_state_by_product { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -21123,20 +29129,20 @@ pub mod tag { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) tag_id: String, + pub(crate) group_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/{}/products/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.tag_id + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -21154,7 +29160,7 @@ pub mod tag { let rsp = 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(()), + 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::ErrorResponse = @@ -21169,7 +29175,31 @@ pub mod tag { } } } - pub mod list_by_service { +} +pub mod product_subscriptions { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -21198,11 +29228,11 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) product_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, - pub(crate) scope: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -21217,18 +29247,15 @@ pub mod tag { self.skip = Some(skip); self } - pub fn scope(mut self, scope: impl Into) -> Self { - self.scope = Some(scope.into()); - self - } - 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.ApiManagement/service/{}/tags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/subscriptions", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -21249,9 +29276,6 @@ pub mod tag { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } - if let Some(scope) = &self.scope { - url.query_pairs_mut().append_pair("scope", scope); - } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -21260,7 +29284,7 @@ pub mod tag { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagCollection = + let rsp_value: models::SubscriptionCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -21278,7 +29302,102 @@ pub mod tag { } } } - pub mod get { +} +pub mod product_policy { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list_by_product::Builder { + list_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + format: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_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, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_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, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_product { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -21307,19 +29426,19 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, + pub(crate) product_id: String, 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.ApiManagement/service/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -21339,7 +29458,7 @@ pub mod tag { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagContract = + let rsp_value: models::PolicyCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -21357,13 +29476,8 @@ pub mod tag { } } } - pub mod create_or_update { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::TagContract), - Ok200(models::TagContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -21391,29 +29505,30 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, - pub(crate) parameters: models::TagCreateUpdateParameters, + pub(crate) product_id: String, + pub(crate) policy_id: String, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) format: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.into()); self } - 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.ApiManagement/service/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -21421,27 +29536,20 @@ pub mod tag { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); - 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); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::TagContract = - 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::TagContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -21457,8 +29565,13 @@ pub mod tag { } } } - pub mod update { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -21486,25 +29599,31 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, - pub(crate) parameters: models::TagCreateUpdateParameters, - pub(crate) if_match: String, + pub(crate) product_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -21512,19 +29631,27 @@ pub mod tag { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-01-01-preview"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } 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.header("If-Match", &self.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::PolicyContract = + 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::TagContract = + let rsp_value: models::PolicyContract = 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)?; @@ -21574,7 +29701,8 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, + pub(crate) product_id: String, + pub(crate) policy_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -21582,12 +29710,13 @@ pub mod tag { 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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -21622,7 +29751,7 @@ pub mod tag { } } } - pub mod get_entity_state { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -21651,19 +29780,21 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, + pub(crate) product_id: String, + pub(crate) policy_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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); diff --git a/services/mgmt/apimanagement/src/package_preview_2021_04/operations.rs b/services/mgmt/apimanagement/src/package_preview_2021_04/operations.rs index fcdda7980d..cfce30a300 100644 --- a/services/mgmt/apimanagement/src/package_preview_2021_04/operations.rs +++ b/services/mgmt/apimanagement/src/package_preview_2021_04/operations.rs @@ -77,9 +77,21 @@ impl Client { pub fn api(&self) -> api::Client { api::Client(self.clone()) } + pub fn api_diagnostic(&self) -> api_diagnostic::Client { + api_diagnostic::Client(self.clone()) + } pub fn api_export(&self) -> api_export::Client { api_export::Client(self.clone()) } + pub fn api_issue(&self) -> api_issue::Client { + api_issue::Client(self.clone()) + } + pub fn api_issue_attachment(&self) -> api_issue_attachment::Client { + api_issue_attachment::Client(self.clone()) + } + pub fn api_issue_comment(&self) -> api_issue_comment::Client { + api_issue_comment::Client(self.clone()) + } pub fn api_management_operations(&self) -> api_management_operations::Client { api_management_operations::Client(self.clone()) } @@ -92,6 +104,30 @@ impl Client { pub fn api_management_skus(&self) -> api_management_skus::Client { api_management_skus::Client(self.clone()) } + pub fn api_operation(&self) -> api_operation::Client { + api_operation::Client(self.clone()) + } + pub fn api_operation_policy(&self) -> api_operation_policy::Client { + api_operation_policy::Client(self.clone()) + } + pub fn api_policy(&self) -> api_policy::Client { + api_policy::Client(self.clone()) + } + pub fn api_product(&self) -> api_product::Client { + api_product::Client(self.clone()) + } + pub fn api_release(&self) -> api_release::Client { + api_release::Client(self.clone()) + } + pub fn api_revision(&self) -> api_revision::Client { + api_revision::Client(self.clone()) + } + pub fn api_schema(&self) -> api_schema::Client { + api_schema::Client(self.clone()) + } + pub fn api_tag_description(&self) -> api_tag_description::Client { + api_tag_description::Client(self.clone()) + } pub fn api_version_set(&self) -> api_version_set::Client { api_version_set::Client(self.clone()) } @@ -170,6 +206,9 @@ impl Client { pub fn open_id_connect_provider(&self) -> open_id_connect_provider::Client { open_id_connect_provider::Client(self.clone()) } + pub fn operation(&self) -> operation::Client { + operation::Client(self.clone()) + } pub fn outbound_network_dependencies_endpoints(&self) -> outbound_network_dependencies_endpoints::Client { outbound_network_dependencies_endpoints::Client(self.clone()) } @@ -268,6 +307,152 @@ pub enum Error { #[error(transparent)] ApiExport_Get(#[from] api_export::get::Error), #[error(transparent)] + Api_ListByService(#[from] api::list_by_service::Error), + #[error(transparent)] + Api_Get(#[from] api::get::Error), + #[error(transparent)] + Api_CreateOrUpdate(#[from] api::create_or_update::Error), + #[error(transparent)] + Api_Update(#[from] api::update::Error), + #[error(transparent)] + Api_Delete(#[from] api::delete::Error), + #[error(transparent)] + Api_GetEntityTag(#[from] api::get_entity_tag::Error), + #[error(transparent)] + ApiRevision_ListByService(#[from] api_revision::list_by_service::Error), + #[error(transparent)] + ApiRelease_ListByService(#[from] api_release::list_by_service::Error), + #[error(transparent)] + ApiRelease_Get(#[from] api_release::get::Error), + #[error(transparent)] + ApiRelease_CreateOrUpdate(#[from] api_release::create_or_update::Error), + #[error(transparent)] + ApiRelease_Update(#[from] api_release::update::Error), + #[error(transparent)] + ApiRelease_Delete(#[from] api_release::delete::Error), + #[error(transparent)] + ApiRelease_GetEntityTag(#[from] api_release::get_entity_tag::Error), + #[error(transparent)] + ApiOperation_ListByApi(#[from] api_operation::list_by_api::Error), + #[error(transparent)] + ApiOperation_Get(#[from] api_operation::get::Error), + #[error(transparent)] + ApiOperation_CreateOrUpdate(#[from] api_operation::create_or_update::Error), + #[error(transparent)] + ApiOperation_Update(#[from] api_operation::update::Error), + #[error(transparent)] + ApiOperation_Delete(#[from] api_operation::delete::Error), + #[error(transparent)] + ApiOperation_GetEntityTag(#[from] api_operation::get_entity_tag::Error), + #[error(transparent)] + ApiOperationPolicy_ListByOperation(#[from] api_operation_policy::list_by_operation::Error), + #[error(transparent)] + ApiOperationPolicy_Get(#[from] api_operation_policy::get::Error), + #[error(transparent)] + ApiOperationPolicy_CreateOrUpdate(#[from] api_operation_policy::create_or_update::Error), + #[error(transparent)] + ApiOperationPolicy_Delete(#[from] api_operation_policy::delete::Error), + #[error(transparent)] + ApiOperationPolicy_GetEntityTag(#[from] api_operation_policy::get_entity_tag::Error), + #[error(transparent)] + Tag_ListByOperation(#[from] tag::list_by_operation::Error), + #[error(transparent)] + Tag_GetByOperation(#[from] tag::get_by_operation::Error), + #[error(transparent)] + Tag_AssignToOperation(#[from] tag::assign_to_operation::Error), + #[error(transparent)] + Tag_DetachFromOperation(#[from] tag::detach_from_operation::Error), + #[error(transparent)] + Tag_GetEntityStateByOperation(#[from] tag::get_entity_state_by_operation::Error), + #[error(transparent)] + ApiProduct_ListByApis(#[from] api_product::list_by_apis::Error), + #[error(transparent)] + ApiPolicy_ListByApi(#[from] api_policy::list_by_api::Error), + #[error(transparent)] + ApiPolicy_Get(#[from] api_policy::get::Error), + #[error(transparent)] + ApiPolicy_CreateOrUpdate(#[from] api_policy::create_or_update::Error), + #[error(transparent)] + ApiPolicy_Delete(#[from] api_policy::delete::Error), + #[error(transparent)] + ApiPolicy_GetEntityTag(#[from] api_policy::get_entity_tag::Error), + #[error(transparent)] + ApiSchema_ListByApi(#[from] api_schema::list_by_api::Error), + #[error(transparent)] + ApiSchema_Get(#[from] api_schema::get::Error), + #[error(transparent)] + ApiSchema_CreateOrUpdate(#[from] api_schema::create_or_update::Error), + #[error(transparent)] + ApiSchema_Delete(#[from] api_schema::delete::Error), + #[error(transparent)] + ApiSchema_GetEntityTag(#[from] api_schema::get_entity_tag::Error), + #[error(transparent)] + ApiDiagnostic_ListByService(#[from] api_diagnostic::list_by_service::Error), + #[error(transparent)] + ApiDiagnostic_Get(#[from] api_diagnostic::get::Error), + #[error(transparent)] + ApiDiagnostic_CreateOrUpdate(#[from] api_diagnostic::create_or_update::Error), + #[error(transparent)] + ApiDiagnostic_Update(#[from] api_diagnostic::update::Error), + #[error(transparent)] + ApiDiagnostic_Delete(#[from] api_diagnostic::delete::Error), + #[error(transparent)] + ApiDiagnostic_GetEntityTag(#[from] api_diagnostic::get_entity_tag::Error), + #[error(transparent)] + ApiIssue_ListByService(#[from] api_issue::list_by_service::Error), + #[error(transparent)] + ApiIssue_Get(#[from] api_issue::get::Error), + #[error(transparent)] + ApiIssue_CreateOrUpdate(#[from] api_issue::create_or_update::Error), + #[error(transparent)] + ApiIssue_Update(#[from] api_issue::update::Error), + #[error(transparent)] + ApiIssue_Delete(#[from] api_issue::delete::Error), + #[error(transparent)] + ApiIssue_GetEntityTag(#[from] api_issue::get_entity_tag::Error), + #[error(transparent)] + ApiIssueComment_ListByService(#[from] api_issue_comment::list_by_service::Error), + #[error(transparent)] + ApiIssueComment_Get(#[from] api_issue_comment::get::Error), + #[error(transparent)] + ApiIssueComment_CreateOrUpdate(#[from] api_issue_comment::create_or_update::Error), + #[error(transparent)] + ApiIssueComment_Delete(#[from] api_issue_comment::delete::Error), + #[error(transparent)] + ApiIssueComment_GetEntityTag(#[from] api_issue_comment::get_entity_tag::Error), + #[error(transparent)] + ApiIssueAttachment_ListByService(#[from] api_issue_attachment::list_by_service::Error), + #[error(transparent)] + ApiIssueAttachment_Get(#[from] api_issue_attachment::get::Error), + #[error(transparent)] + ApiIssueAttachment_CreateOrUpdate(#[from] api_issue_attachment::create_or_update::Error), + #[error(transparent)] + ApiIssueAttachment_Delete(#[from] api_issue_attachment::delete::Error), + #[error(transparent)] + ApiIssueAttachment_GetEntityTag(#[from] api_issue_attachment::get_entity_tag::Error), + #[error(transparent)] + ApiTagDescription_ListByService(#[from] api_tag_description::list_by_service::Error), + #[error(transparent)] + ApiTagDescription_Get(#[from] api_tag_description::get::Error), + #[error(transparent)] + ApiTagDescription_CreateOrUpdate(#[from] api_tag_description::create_or_update::Error), + #[error(transparent)] + ApiTagDescription_Delete(#[from] api_tag_description::delete::Error), + #[error(transparent)] + ApiTagDescription_GetEntityTag(#[from] api_tag_description::get_entity_tag::Error), + #[error(transparent)] + Tag_ListByApi(#[from] tag::list_by_api::Error), + #[error(transparent)] + Tag_GetByApi(#[from] tag::get_by_api::Error), + #[error(transparent)] + Tag_AssignToApi(#[from] tag::assign_to_api::Error), + #[error(transparent)] + Tag_DetachFromApi(#[from] tag::detach_from_api::Error), + #[error(transparent)] + Tag_GetEntityStateByApi(#[from] tag::get_entity_state_by_api::Error), + #[error(transparent)] + Operation_ListByTags(#[from] operation::list_by_tags::Error), + #[error(transparent)] Api_ListByTags(#[from] api::list_by_tags::Error), #[error(transparent)] ApiVersionSet_ListByService(#[from] api_version_set::list_by_service::Error), @@ -922,6 +1107,109 @@ pub mod api { use super::models; 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, + tags: None, + expand_api_version_set: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + delete_revisions: None, + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } pub fn list_by_tags( &self, resource_group_name: impl Into, @@ -940,7 +1228,7 @@ pub mod api { } } } - pub mod list_by_tags { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -973,7 +1261,8 @@ pub mod api { pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, - pub(crate) include_not_tagged_apis: Option, + pub(crate) tags: Option, + pub(crate) expand_api_version_set: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -988,14 +1277,18 @@ pub mod api { self.skip = Some(skip); self } - pub fn include_not_tagged_apis(mut self, include_not_tagged_apis: bool) -> Self { - self.include_not_tagged_apis = Some(include_not_tagged_apis); + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.into()); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn expand_api_version_set(mut self, expand_api_version_set: bool) -> Self { + self.expand_api_version_set = Some(expand_api_version_set); + 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/{}/apisByTags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -1020,9 +1313,12 @@ pub mod api { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } - if let Some(include_not_tagged_apis) = &self.include_not_tagged_apis { + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } + if let Some(expand_api_version_set) = &self.expand_api_version_set { url.query_pairs_mut() - .append_pair("includeNotTaggedApis", &include_not_tagged_apis.to_string()); + .append_pair("expandApiVersionSet", &expand_api_version_set.to_string()); } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); @@ -1032,7 +1328,7 @@ pub mod api { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagResourceCollection = + let rsp_value: models::ApiCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1050,255 +1346,48 @@ pub mod api { } } } -} -pub mod api_version_set { - use super::models; - 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, - version_set_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(), - version_set_id: version_set_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - version_set_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(), - version_set_id: version_set_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - version_set_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - version_set_id: version_set_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - version_set_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(), - version_set_id: version_set_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, - version_set_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(), - version_set_id: version_set_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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/{}/apiVersionSets", - 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", "2021-04-01-preview"); - 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::ApiVersionSetCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_id: String, + pub(crate) api_id: String, 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.ApiManagement/service/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1318,7 +1407,7 @@ pub mod api_version_set { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiVersionSetContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1340,8 +1429,9 @@ pub mod api_version_set { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::ApiVersionSetContract), - Ok200(models::ApiVersionSetContract), + Created201(models::ApiContract), + Accepted202, + Ok200(models::ApiContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1370,8 +1460,8 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, - pub(crate) parameters: models::ApiVersionSetContract, + pub(crate) api_id: String, + pub(crate) parameters: models::ApiCreateOrUpdateParameter, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -1383,12 +1473,12 @@ pub mod api_version_set { 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/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1412,13 +1502,14 @@ pub mod api_version_set { 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::ApiVersionSetContract = + let rsp_value: models::ApiContract = 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), http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiVersionSetContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -1465,21 +1556,21 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, - pub(crate) parameters: models::ApiVersionSetUpdateParameters, + pub(crate) api_id: String, + pub(crate) parameters: models::ApiUpdateContract, pub(crate) if_match: String, 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.ApiManagement/service/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1501,7 +1592,7 @@ pub mod api_version_set { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiVersionSetContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1553,20 +1644,25 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, + pub(crate) api_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) delete_revisions: Option, } impl Builder { + pub fn delete_revisions(mut self, delete_revisions: bool) -> Self { + self.delete_revisions = Some(delete_revisions); + 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/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1578,6 +1674,9 @@ pub mod api_version_set { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); + if let Some(delete_revisions) = &self.delete_revisions { + url.query_pairs_mut().append_pair("deleteRevisions", &delete_revisions.to_string()); + } 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()); @@ -1630,19 +1729,19 @@ pub mod api_version_set { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) version_set_id: String, + pub(crate) api_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/{}/apiVersionSets/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.version_set_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1675,128 +1774,7 @@ pub mod api_version_set { } } } -} -pub mod authorization_server { - use super::models; - 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, - authsid: 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(), - authsid: authsid.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: 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(), - authsid: authsid.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - authsid: authsid.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: 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(), - authsid: authsid.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, - authsid: 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(), - authsid: authsid.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_secrets( - &self, - resource_group_name: impl Into, - service_name: impl Into, - authsid: impl Into, - subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - authsid: authsid.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod list_by_tags { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1829,6 +1807,7 @@ pub mod authorization_server { pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, + pub(crate) include_not_tagged_apis: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -1843,12 +1822,14 @@ pub mod authorization_server { self.skip = Some(skip); self } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn include_not_tagged_apis(mut self, include_not_tagged_apis: bool) -> Self { + self.include_not_tagged_apis = Some(include_not_tagged_apis); + 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/{}/authorizationServers", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apisByTags", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -1873,6 +1854,10 @@ pub mod authorization_server { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } + if let Some(include_not_tagged_apis) = &self.include_not_tagged_apis { + url.query_pairs_mut() + .append_pair("includeNotTaggedApis", &include_not_tagged_apis.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)?; @@ -1881,7 +1866,7 @@ pub mod authorization_server { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerCollection = + let rsp_value: models::TagResourceCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1899,7 +1884,31 @@ pub mod authorization_server { } } } - pub mod get { +} +pub mod api_revision { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1928,21 +1937,34 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, + pub(crate) api_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/revisions", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1954,6 +1976,15 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); + 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)?; @@ -1962,7 +1993,7 @@ pub mod authorization_server { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerContract = + let rsp_value: models::ApiRevisionCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1980,63 +2011,185 @@ pub mod authorization_server { } } } - pub mod create_or_update { - use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::AuthorizationServerContract), - Ok200(models::AuthorizationServerContract), +} +pub mod api_release { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } } - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_id.into(), + subscription_id: subscription_id.into(), + } } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + release_id: release_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_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, + api_id: impl Into, + release_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(), + api_id: api_id.into(), + release_id: release_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: String, - pub(crate) parameters: models::AuthorizationServerContract, + pub(crate) api_id: String, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + 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> { + 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2044,27 +2197,26 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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); + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerContract = - 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::AuthorizationServerContract = + let rsp_value: models::ApiReleaseCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -2080,7 +2232,7 @@ pub mod authorization_server { } } } - pub mod update { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2109,27 +2261,25 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, - pub(crate) parameters: models::AuthorizationServerUpdateContract, - pub(crate) if_match: String, + pub(crate) api_id: String, + pub(crate) release_id: String, 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.ApiManagement/service/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2137,9 +2287,7 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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.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)?; @@ -2147,7 +2295,7 @@ pub mod authorization_server { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::AuthorizationServerContract = + let rsp_value: models::ApiReleaseContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2165,12 +2313,12 @@ pub mod authorization_server { } } } - pub mod delete { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200, - NoContent204, + Created201(models::ApiReleaseContract), + Ok200(models::ApiReleaseContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2199,24 +2347,31 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, - pub(crate) if_match: String, + pub(crate) api_id: String, + pub(crate) release_id: String, + pub(crate) parameters: models::ApiReleaseContract, 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2224,15 +2379,28 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - req_builder = req_builder.header("If-Match", &self.if_match); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiReleaseContract = + 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::ApiReleaseContract = + 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 = @@ -2247,7 +2415,7 @@ pub mod authorization_server { } } } - pub mod get_entity_tag { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2276,23 +2444,27 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, + pub(crate) api_id: String, + pub(crate) release_id: String, + pub(crate) parameters: models::ApiReleaseContract, + pub(crate) if_match: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/authorizationServers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.authsid + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2300,13 +2472,20 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::OK => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiReleaseContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -2321,8 +2500,13 @@ pub mod authorization_server { } } } - pub mod list_secrets { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -2350,18 +2534,26 @@ pub mod authorization_server { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) authsid: String, + pub(crate) api_id: String, + pub(crate) release_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> { + 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/{}/authorizationServers/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . authsid) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.release_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -2369,19 +2561,15 @@ pub mod authorization_server { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); 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::AuthorizationServerSecretsContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -2396,39 +2584,120 @@ pub mod authorization_server { } } } -} -pub mod backend { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_service( - &self, + pub mod get_entity_tag { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) release_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/{}/apis/{}/releases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.release_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_operation { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, resource_group_name: impl Into, service_name: impl Into, + api_id: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> list_by_api::Builder { + list_by_api::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, + tags: None, } } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, + api_id: impl Into, + operation_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(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), } } @@ -2436,15 +2705,17 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_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(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -2454,8 +2725,9 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -2463,7 +2735,8 @@ pub mod backend { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), @@ -2473,7 +2746,8 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, + api_id: impl Into, + operation_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -2481,7 +2755,8 @@ pub mod backend { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -2490,35 +2765,21 @@ pub mod backend { &self, resource_group_name: impl Into, service_name: impl Into, - backend_id: impl Into, + api_id: impl Into, + operation_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(), - backend_id: backend_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn reconnect( - &self, - resource_group_name: impl Into, - service_name: impl Into, - backend_id: impl Into, - subscription_id: impl Into, - ) -> reconnect::Builder { - reconnect::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - backend_id: backend_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), - parameters: None, } } } - pub mod list_by_service { + pub mod list_by_api { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2547,10 +2808,12 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) api_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, + pub(crate) tags: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -2565,14 +2828,19 @@ pub mod backend { self.skip = Some(skip); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.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/{}/backends", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2593,6 +2861,9 @@ pub mod backend { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -2601,7 +2872,7 @@ pub mod backend { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackendCollection = + let rsp_value: models::OperationCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2648,19 +2919,21 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, 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.ApiManagement/service/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2680,7 +2953,7 @@ pub mod backend { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackendContract = + let rsp_value: models::OperationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2702,8 +2975,8 @@ pub mod backend { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::BackendContract), - Ok200(models::BackendContract), + Created201(models::OperationContract), + Ok200(models::OperationContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2732,8 +3005,9 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, - pub(crate) parameters: models::BackendContract, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) parameters: models::OperationContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -2745,12 +3019,13 @@ pub mod backend { 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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2774,13 +3049,13 @@ pub mod backend { 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::BackendContract = + let rsp_value: models::OperationContract = 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::BackendContract = + let rsp_value: models::OperationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -2827,21 +3102,23 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, - pub(crate) parameters: models::BackendUpdateParameters, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) parameters: models::OperationUpdateContract, pub(crate) if_match: String, 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.ApiManagement/service/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2863,7 +3140,7 @@ pub mod backend { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::BackendContract = + let rsp_value: models::OperationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2915,7 +3192,8 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -2923,12 +3201,13 @@ pub mod backend { 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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -2992,19 +3271,21 @@ pub mod backend { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) backend_id: String, + pub(crate) api_id: String, + pub(crate) operation_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/{}/backends/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.backend_id + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -3037,167 +3318,77 @@ pub mod backend { } } } - pub mod reconnect { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) backend_id: 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<(), Error>> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}/reconnect", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.backend_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", "2021-04-01-preview"); - 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::ACCEPTED => 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 cache { +pub mod api_operation_policy { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_service( + pub fn list_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> list_by_operation::Builder { + list_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), - top: None, - skip: None, } } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_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(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), + format: None, } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_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(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, } } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - cache_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - cache_id: cache_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -3205,7 +3396,9 @@ pub mod cache { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -3214,19 +3407,23 @@ pub mod cache { &self, resource_group_name: impl Into, service_name: impl Into, - cache_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_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(), - cache_id: cache_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_service { + pub mod list_by_operation { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3255,27 +3452,21 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, pub(crate) subscription_id: String, - pub(crate) top: Option, - pub(crate) skip: Option, } impl Builder { - 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> { + 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/{}/caches", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.api_id, + &self.operation_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -3287,12 +3478,6 @@ pub mod cache { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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)?; @@ -3301,7 +3486,7 @@ pub mod cache { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CacheCollection = + let rsp_value: models::PolicyCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -3348,20 +3533,20 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_id: String, pub(crate) subscription_id: String, + pub(crate) format: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3372,6 +3557,9 @@ pub mod cache { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -3380,7 +3568,7 @@ pub mod cache { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CacheContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -3402,8 +3590,8 @@ pub mod cache { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::CacheContract), - Ok200(models::CacheContract), + Created201(models::PolicyContract), + Ok200(models::PolicyContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3432,8 +3620,10 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, - pub(crate) parameters: models::CacheContract, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -3444,14 +3634,7 @@ pub mod cache { } 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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3474,13 +3657,13 @@ pub mod cache { 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::CacheContract = + let rsp_value: models::PolicyContract = 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::CacheContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -3498,89 +3681,6 @@ pub mod cache { } } } - pub mod update { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) cache_id: String, - pub(crate) parameters: models::CacheUpdateParameters, - 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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_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", "2021-04-01-preview"); - 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.header("If-Match", &self.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::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CacheContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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; #[derive(Debug)] @@ -3615,21 +3715,16 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3692,20 +3787,15 @@ pub mod cache { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) cache_id: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_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/{}/caches/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.cache_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_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); @@ -3738,110 +3828,7635 @@ pub mod cache { } } } -pub mod certificate { +pub mod tag { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_service( + pub fn list_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> list_by_operation::Builder { + list_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, - is_key_vault_refresh_failed: None, } } - pub fn get( + pub fn get_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> get::Builder { - get::Builder { + ) -> get_by_operation::Builder { + get_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), } } - pub fn create_or_update( + pub fn assign_to_operation( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, - parameters: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> create_or_update::Builder { - create_or_update::Builder { + ) -> assign_to_operation::Builder { + assign_to_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), - parameters: parameters.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), - if_match: None, } } - pub fn delete( + pub fn detach_from_operation( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, - if_match: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> delete::Builder { - delete::Builder { + ) -> detach_from_operation::Builder { + detach_from_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), - if_match: if_match.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), } } - pub fn get_entity_tag( + pub fn get_entity_state_by_operation( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, subscription_id: impl Into, - ) -> get_entity_tag::Builder { - get_entity_tag::Builder { + ) -> get_entity_state_by_operation::Builder { + get_entity_state_by_operation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), subscription_id: subscription_id.into(), } } - pub fn refresh_secret( + pub fn list_by_api( &self, resource_group_name: impl Into, service_name: impl Into, - certificate_id: impl Into, + api_id: impl Into, subscription_id: impl Into, - ) -> refresh_secret::Builder { - refresh_secret::Builder { + ) -> list_by_api::Builder { + list_by_api::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - certificate_id: certificate_id.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_by_api::Builder { + get_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn assign_to_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> assign_to_api::Builder { + assign_to_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn detach_from_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> detach_from_api::Builder { + detach_from_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state_by_api::Builder { + get_entity_state_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list_by_product::Builder { + list_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_by_product::Builder { + get_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn assign_to_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> assign_to_product::Builder { + assign_to_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn detach_from_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> detach_from_product::Builder { + detach_from_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state_by_product::Builder { + get_entity_state_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + 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, + scope: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_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(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_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(), + tag_id: tag_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + tag_id: tag_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_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(), + tag_id: tag_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state::Builder { + get_entity_state::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: 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/{}/apis/{}/operations/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2021-04-01-preview"); + 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::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 assign_to_operation { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TagContract = + 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::TagContract = + 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 detach_from_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_state_by_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_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/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2021-04-01-preview"); + 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::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 assign_to_api { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TagContract = + 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::TagContract = + 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 detach_from_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_state_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_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/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_by_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: 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/{}/products/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_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", "2021-04-01-preview"); + 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::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 assign_to_product { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TagContract = + 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::TagContract = + 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 detach_from_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_state_by_product { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) product_id: String, + pub(crate) tag_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/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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, + pub(crate) scope: 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 scope(mut self, scope: impl Into) -> Self { + self.scope = Some(scope.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/{}/tags", + 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", "2021-04-01-preview"); + 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()); + } + if let Some(scope) = &self.scope { + url.query_pairs_mut().append_pair("scope", scope); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_id: String, + pub(crate) parameters: models::TagCreateUpdateParameters, + 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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2021-04-01-preview"); + 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::TagContract = + 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::TagContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_id: String, + pub(crate) parameters: models::TagCreateUpdateParameters, + 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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2021-04-01-preview"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2021-04-01-preview"); + 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_state { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) tag_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/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_product { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_apis( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_apis::Builder { + list_by_apis::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list_by_apis { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/products", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2021-04-01-preview"); + 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::ProductCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 api_policy { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + format: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_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, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_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, + api_id: impl Into, + policy_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(), + api_id: api_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_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/{}/apis/{}/policies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match 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)?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_id: String, + pub(crate) subscription_id: String, + pub(crate) format: Option, + } + impl Builder { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2021-04-01-preview"); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, + 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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2021-04-01-preview"); + 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::PolicyContract = + 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::PolicyContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2021-04-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) policy_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/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_schema { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.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, + api_id: 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(), + api_id: api_id.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, + api_id: 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(), + api_id: api_id.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, + api_id: 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(), + api_id: api_id.into(), + schema_id: schema_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + force: None, + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + schema_id: schema_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_api { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/schemas", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2021-04-01-preview"); + 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::ApiSchemaCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiSchemaContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Accepted202, + Created201(models::ApiSchemaContract), + Ok200(models::ApiSchemaContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) schema_id: String, + pub(crate) parameters: models::ApiSchemaContract, + 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2021-04-01-preview"); + 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::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiSchemaContract = + 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::ApiSchemaContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) schema_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + pub(crate) force: Option, + } + impl Builder { + pub fn force(mut self, force: bool) -> Self { + self.force = Some(force); + 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2021-04-01-preview"); + if let Some(force) = &self.force { + url.query_pairs_mut().append_pair("force", &force.to_string()); + } + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_diagnostic { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.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, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_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, + api_id: impl Into, + diagnostic_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(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/diagnostics", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2021-04-01-preview"); + 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::DiagnosticCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::DiagnosticContract), + Ok200(models::DiagnosticContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + 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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2021-04-01-preview"); + 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::DiagnosticContract = + 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::DiagnosticContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + 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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2021-04-01-preview"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2021-04-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) diagnostic_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/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_issue { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + expand_comments_attachments: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + expand_comments_attachments: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + issue_id: issue_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_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, + api_id: impl Into, + issue_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) expand_comments_attachments: 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 expand_comments_attachments(mut self, expand_comments_attachments: bool) -> Self { + self.expand_comments_attachments = Some(expand_comments_attachments); + 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/{}/apis/{}/issues", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2021-04-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(expand_comments_attachments) = &self.expand_comments_attachments { + url.query_pairs_mut() + .append_pair("expandCommentsAttachments", &expand_comments_attachments.to_string()); + } + 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::IssueCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) subscription_id: String, + pub(crate) expand_comments_attachments: Option, + } + impl Builder { + pub fn expand_comments_attachments(mut self, expand_comments_attachments: bool) -> Self { + self.expand_comments_attachments = Some(expand_comments_attachments); + 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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2021-04-01-preview"); + if let Some(expand_comments_attachments) = &self.expand_comments_attachments { + url.query_pairs_mut() + .append_pair("expandCommentsAttachments", &expand_comments_attachments.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::IssueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueContract), + Ok200(models::IssueContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) parameters: models::IssueContract, + 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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2021-04-01-preview"); + 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::IssueContract = + 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::IssueContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) parameters: models::IssueUpdateContract, + 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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2021-04-01-preview"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2021-04-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_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/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_issue_comment { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: 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(), + api_id: api_id.into(), + issue_id: issue_id.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, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_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, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_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, + api_id: impl Into, + issue_id: impl Into, + comment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: 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/{}/apis/{}/issues/{}/comments", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2021-04-01-preview"); + 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::IssueCommentCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueCommentContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueCommentContract), + Ok200(models::IssueCommentContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_id: String, + pub(crate) parameters: models::IssueCommentContract, + 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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2021-04-01-preview"); + 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::IssueCommentContract = + 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::IssueCommentContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2021-04-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_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/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_issue_attachment { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: 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(), + api_id: api_id.into(), + issue_id: issue_id.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, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_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, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_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, + api_id: impl Into, + issue_id: impl Into, + attachment_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(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: 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/{}/apis/{}/issues/{}/attachments", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_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", "2021-04-01-preview"); + 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::IssueAttachmentCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueAttachmentContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueAttachmentContract), + Ok200(models::IssueAttachmentContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_id: String, + pub(crate) parameters: models::IssueAttachmentContract, + 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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2021-04-01-preview"); + 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::IssueAttachmentContract = + 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::IssueAttachmentContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2021-04-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_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/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 api_tag_description { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: 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(), + api_id: api_id.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, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_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, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_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, + api_id: impl Into, + tag_description_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(), + api_id: api_id.into(), + tag_description_id: tag_description_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: 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/{}/apis/{}/tagDescriptions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2021-04-01-preview"); + 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::TagDescriptionCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagDescriptionContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::TagDescriptionContract), + Ok200(models::TagDescriptionContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_id: String, + pub(crate) parameters: models::TagDescriptionCreateParameters, + 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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2021-04-01-preview"); + 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::TagDescriptionContract = + 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::TagDescriptionContract = + 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 delete { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2021-04-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) tag_description_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/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 operation { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_tags( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_tags::Builder { + list_by_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + include_not_tagged_operations: None, + } + } + } + pub mod list_by_tags { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) include_not_tagged_operations: 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 include_not_tagged_operations(mut self, include_not_tagged_operations: bool) -> Self { + self.include_not_tagged_operations = Some(include_not_tagged_operations); + 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/{}/apis/{}/operationsByTags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_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", "2021-04-01-preview"); + 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()); + } + if let Some(include_not_tagged_operations) = &self.include_not_tagged_operations { + url.query_pairs_mut() + .append_pair("includeNotTaggedOperations", &include_not_tagged_operations.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::TagResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 api_version_set { + use super::models; + 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, + version_set_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(), + version_set_id: version_set_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_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(), + version_set_id: version_set_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + version_set_id: version_set_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_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(), + version_set_id: version_set_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, + version_set_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(), + version_set_id: version_set_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/apiVersionSets", + 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", "2021-04-01-preview"); + 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::ApiVersionSetCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiVersionSetContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::ApiVersionSetContract), + Ok200(models::ApiVersionSetContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_id: String, + pub(crate) parameters: models::ApiVersionSetContract, + 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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2021-04-01-preview"); + 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::ApiVersionSetContract = + 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::ApiVersionSetContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_id: String, + pub(crate) parameters: models::ApiVersionSetUpdateParameters, + 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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2021-04-01-preview"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiVersionSetContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2021-04-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) version_set_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/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 authorization_server { + use super::models; + 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, + authsid: 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(), + authsid: authsid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: 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(), + authsid: authsid.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + authsid: authsid.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: 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(), + authsid: authsid.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, + authsid: 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(), + authsid: authsid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + authsid: authsid.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/authorizationServers", + 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", "2021-04-01-preview"); + 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::AuthorizationServerCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationServerContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::AuthorizationServerContract), + Ok200(models::AuthorizationServerContract), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: String, + pub(crate) parameters: models::AuthorizationServerContract, + 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2021-04-01-preview"); + 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::AuthorizationServerContract = + 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::AuthorizationServerContract = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) authsid: String, + pub(crate) parameters: models::AuthorizationServerUpdateContract, + 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/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = 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", "2021-04-01-preview"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationServerContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_service { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -3869,41 +11484,24 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) authsid: String, + pub(crate) if_match: String, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, - pub(crate) is_key_vault_refresh_failed: 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 is_key_vault_refresh_failed(mut self, is_key_vault_refresh_failed: bool) -> Self { - self.is_key_vault_refresh_failed = Some(is_key_vault_refresh_failed); - self - } - 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.ApiManagement/service/{}/certificates", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/authorizationServers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.authsid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -3911,31 +11509,15 @@ pub mod certificate { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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()); - } - if let Some(is_key_vault_refresh_failed) = &self.is_key_vault_refresh_failed { - url.query_pairs_mut() - .append_pair("isKeyVaultRefreshFailed", &is_key_vault_refresh_failed.to_string()); - } + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CertificateCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -3950,7 +11532,7 @@ pub mod certificate { } } } - pub mod get { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3979,23 +11561,23 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, + pub(crate) authsid: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/authorizationServers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.certificate_id + &self.authsid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4009,12 +11591,7 @@ pub mod certificate { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CertificateContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -4029,13 +11606,8 @@ pub mod certificate { } } } - pub mod create_or_update { + pub mod list_secrets { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::CertificateContract), - Ok200(models::CertificateContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -4063,29 +11635,18 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, - pub(crate) parameters: models::CertificateCreateOrUpdateParameters, + pub(crate) authsid: String, 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> { + 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/{}/certificates/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.certificate_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/authorizationServers/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . authsid) ; let mut url = 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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4093,27 +11654,18 @@ pub mod certificate { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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); - } + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::CertificateContract = - 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::CertificateContract = + let rsp_value: models::AuthorizationServerSecretsContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -4129,13 +11681,130 @@ pub mod certificate { } } } - pub mod delete { +} +pub mod backend { + use super::models; + 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, + backend_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(), + backend_id: backend_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_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(), + backend_id: backend_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + backend_id: backend_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_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(), + backend_id: backend_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, + backend_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(), + backend_id: backend_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn reconnect( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_id: impl Into, + subscription_id: impl Into, + ) -> reconnect::Builder { + reconnect::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + backend_id: backend_id.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + } + pub mod list_by_service { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -4163,24 +11832,36 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, - pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/certificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.certificate_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4188,15 +11869,27 @@ pub mod certificate { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - req_builder = req_builder.header("If-Match", &self.if_match); + 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 => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackendCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -4211,7 +11904,7 @@ pub mod certificate { } } } - pub mod get_entity_tag { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4240,23 +11933,23 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, + pub(crate) backend_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/certificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.certificate_id + &self.backend_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4270,7 +11963,12 @@ pub mod certificate { let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackendContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -4285,8 +11983,13 @@ pub mod certificate { } } } - pub mod refresh_secret { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::BackendContract), + Ok200(models::BackendContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -4314,23 +12017,29 @@ pub mod certificate { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) certificate_id: String, + pub(crate) backend_id: String, + pub(crate) parameters: models::BackendContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/certificates/{}/refreshSecret", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.certificate_id + &self.backend_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4338,18 +12047,27 @@ pub mod certificate { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + 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::BackendContract = + 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::CertificateContract = + let rsp_value: models::BackendContract = 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)?; @@ -4365,74 +12083,7 @@ pub mod certificate { } } } -} -pub mod content_type { - use super::models; - 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(), - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - content_type_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(), - content_type_id: content_type_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - content_type_id: 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(), - content_type_id: content_type_id.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - content_type_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(), - content_type_id: content_type_id.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4461,21 +12112,25 @@ pub mod content_type { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) backend_id: String, + pub(crate) parameters: models::BackendUpdateParameters, + pub(crate) if_match: String, 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.ApiManagement/service/{}/contentTypes", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.backend_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4483,7 +12138,9 @@ pub mod content_type { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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)?; @@ -4491,7 +12148,7 @@ pub mod content_type { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ContentTypeCollection = + let rsp_value: models::BackendContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -4509,8 +12166,13 @@ pub mod content_type { } } } - pub mod get { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -4538,23 +12200,24 @@ pub mod content_type { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, + pub(crate) backend_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> { + 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/{}/contentTypes/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.content_type_id + &self.backend_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4562,18 +12225,15 @@ pub mod content_type { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ContentTypeContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -4588,13 +12248,8 @@ pub mod content_type { } } } - pub mod create_or_update { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ContentTypeContract), - Ok200(models::ContentTypeContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -4622,56 +12277,37 @@ pub mod content_type { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, + pub(crate) backend_id: String, 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> { + 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/{}/contentTypes/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.content_type_id + &self.backend_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); + 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", "2021-04-01-preview"); - if let Some(if_match) = &self.if_match { - req_builder = req_builder.header("If-Match", if_match); - } + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ContentTypeContract = - 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::ContentTypeContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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 = @@ -4686,13 +12322,8 @@ pub mod content_type { } } } - pub mod delete { + pub mod reconnect { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -4720,24 +12351,28 @@ pub mod content_type { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) if_match: String, + pub(crate) backend_id: String, pub(crate) subscription_id: String, + pub(crate) parameters: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}/reconnect", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.content_type_id + &self.backend_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4745,15 +12380,18 @@ pub mod content_type { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - req_builder = req_builder.header("If-Match", &self.if_match); - let req_body = azure_core::EMPTY_BODY; + 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::NO_CONTENT => Ok(Response::NoContent204), + 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::ErrorResponse = @@ -4769,7 +12407,7 @@ pub mod content_type { } } } -pub mod content_item { +pub mod cache { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -4777,31 +12415,29 @@ pub mod content_item { &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: 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(), - content_type_id: content_type_id.into(), subscription_id: subscription_id.into(), + top: None, + skip: None, } } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: impl Into, - content_item_id: impl Into, + cache_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(), - content_type_id: content_type_id.into(), - content_item_id: content_item_id.into(), + cache_id: cache_id.into(), subscription_id: subscription_id.into(), } } @@ -4809,26 +12445,44 @@ pub mod content_item { &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: impl Into, - content_item_id: impl Into, + cache_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(), - content_type_id: content_type_id.into(), - content_item_id: content_item_id.into(), + cache_id: cache_id.into(), + parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, } } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + cache_id: cache_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: impl Into, - content_item_id: impl Into, + cache_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -4836,8 +12490,7 @@ pub mod content_item { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - content_type_id: content_type_id.into(), - content_item_id: content_item_id.into(), + cache_id: cache_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -4846,22 +12499,197 @@ pub mod content_item { &self, resource_group_name: impl Into, service_name: impl Into, - content_type_id: impl Into, - content_item_id: impl Into, + cache_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(), - content_type_id: content_type_id.into(), - content_item_id: content_item_id.into(), + cache_id: cache_id.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_service { + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) top: Option, + pub(crate) skip: Option, + } + impl Builder { + 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/{}/caches", + 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", "2021-04-01-preview"); + 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::CacheCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) cache_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/{}/caches/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.cache_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CacheContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::CacheContract), + Ok200(models::CacheContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -4889,23 +12717,29 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, + pub(crate) cache_id: String, + pub(crate) parameters: models::CacheContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/contentTypes/{}/contentItems", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.content_type_id + &self.cache_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4913,17 +12747,27 @@ pub mod content_item { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::CacheContract = + 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::ContentItemCollection = + let rsp_value: models::CacheContract = 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)?; @@ -4939,7 +12783,7 @@ pub mod content_item { } } } - pub mod get { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4968,17 +12812,25 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) content_item_id: String, + pub(crate) cache_id: String, + pub(crate) parameters: models::CacheUpdateParameters, + pub(crate) if_match: String, 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.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.cache_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4986,7 +12838,9 @@ pub mod content_item { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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)?; @@ -4994,7 +12848,7 @@ pub mod content_item { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ContentItemContract = + let rsp_value: models::CacheContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -5012,12 +12866,12 @@ pub mod content_item { } } } - pub mod create_or_update { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::ContentItemContract), - Ok200(models::ContentItemContract), + Ok200, + NoContent204, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5046,22 +12900,24 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) content_item_id: String, + pub(crate) cache_id: String, + pub(crate) if_match: String, 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/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.cache_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5069,27 +12925,15 @@ pub mod content_item { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - if let Some(if_match) = &self.if_match { - req_builder = req_builder.header("If-Match", if_match); - } + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ContentItemContract = - 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::ContentItemContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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 = @@ -5104,13 +12948,8 @@ pub mod content_item { } } } - pub mod delete { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -5138,49 +12977,155 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) content_item_id: String, - pub(crate) if_match: String, + pub(crate) cache_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/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_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", "2021-04-01-preview"); - 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, - }) - } - } - }) + 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/{}/caches/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.cache_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 certificate { + use super::models; + 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, + is_key_vault_refresh_failed: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + certificate_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(), + certificate_id: certificate_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + certificate_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(), + certificate_id: certificate_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, + certificate_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(), + certificate_id: certificate_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, + certificate_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(), + certificate_id: certificate_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn refresh_secret( + &self, + resource_group_name: impl Into, + service_name: impl Into, + certificate_id: impl Into, + subscription_id: impl Into, + ) -> refresh_secret::Builder { + refresh_secret::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + certificate_id: certificate_id.into(), + subscription_id: subscription_id.into(), } } } - pub mod get_entity_tag { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5209,17 +13154,41 @@ pub mod content_item { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) content_type_id: String, - pub(crate) content_item_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) is_key_vault_refresh_failed: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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 is_key_vault_refresh_failed(mut self, is_key_vault_refresh_failed: bool) -> Self { + self.is_key_vault_refresh_failed = Some(is_key_vault_refresh_failed); + 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/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/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::HEAD); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5227,13 +13196,31 @@ pub mod content_item { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); + 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()); + } + if let Some(is_key_vault_refresh_failed) = &self.is_key_vault_refresh_failed { + url.query_pairs_mut() + .append_pair("isKeyVaultRefreshFailed", &is_key_vault_refresh_failed.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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CertificateCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -5248,45 +13235,7 @@ pub mod content_item { } } } -} -pub mod deleted_services { - use super::models; - 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 get_by_name( - &self, - service_name: impl Into, - subscription_id: impl Into, - location: impl Into, - ) -> get_by_name::Builder { - get_by_name::Builder { - client: self.0.clone(), - service_name: service_name.into(), - subscription_id: subscription_id.into(), - location: location.into(), - } - } - pub fn purge( - &self, - service_name: impl Into, - subscription_id: impl Into, - location: impl Into, - ) -> purge::Builder { - purge::Builder { - client: self.0.clone(), - service_name: service_name.into(), - subscription_id: subscription_id.into(), - location: location.into(), - } - } - } - pub mod list_by_subscription { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5313,15 +13262,21 @@ pub mod deleted_services { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) certificate_id: String, 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.ApiManagement/deletedservices", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", self.client.endpoint(), - &self.subscription_id + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -5341,7 +13296,7 @@ pub mod deleted_services { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DeletedServicesCollection = + let rsp_value: models::CertificateContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -5359,8 +13314,13 @@ pub mod deleted_services { } } } - pub mod get_by_name { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::CertificateContract), + Ok200(models::CertificateContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -5386,23 +13346,31 @@ pub mod deleted_services { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) certificate_id: String, + pub(crate) parameters: models::CertificateCreateOrUpdateParameters, pub(crate) subscription_id: String, - pub(crate) location: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/providers/Microsoft.ApiManagement/locations/{}/deletedservices/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", self.client.endpoint(), &self.subscription_id, - &self.location, - &self.service_name + &self.resource_group_name, + &self.service_name, + &self.certificate_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5410,17 +13378,27 @@ pub mod deleted_services { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::CertificateContract = + 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::DeletedServiceContract = + let rsp_value: models::CertificateContract = 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)?; @@ -5436,12 +13414,11 @@ pub mod deleted_services { } } } - pub mod purge { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { Ok200, - Accepted202(models::DeletedServiceContract), NoContent204, } #[derive(Debug, thiserror :: Error)] @@ -5469,19 +13446,22 @@ pub mod deleted_services { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) certificate_id: String, + pub(crate) if_match: String, 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.ApiManagement/locations/{}/deletedservices/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", self.client.endpoint(), &self.subscription_id, - &self.location, - &self.service_name + &self.resource_group_name, + &self.service_name, + &self.certificate_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -5493,6 +13473,7 @@ pub mod deleted_services { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); + 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)?; @@ -5500,12 +13481,6 @@ pub mod deleted_services { 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::DeletedServiceContract = - 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)?; @@ -5521,16 +13496,7 @@ pub mod deleted_services { } } } -} -pub mod api_management_operations { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list(&self) -> list::Builder { - list::Builder { client: self.0.clone() } - } - } - pub mod list { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5557,14 +13523,25 @@ pub mod api_management_operations { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) certificate_id: String, + 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<(), Error>> { Box::pin(async move { - let url_str = &format!("{}/providers/Microsoft.ApiManagement/operations", self.client.endpoint(),); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5578,12 +13555,7 @@ pub mod api_management_operations { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match 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) - } + 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 = @@ -5598,27 +13570,7 @@ pub mod api_management_operations { } } } -} -pub mod api_management_service_skus { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - #[doc = "Gets available SKUs for API Management service"] - pub fn list_available_service_skus( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> list_available_service_skus::Builder { - list_available_service_skus::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_available_service_skus { + pub mod refresh_secret { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5647,21 +13599,23 @@ pub mod api_management_service_skus { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) certificate_id: String, 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.ApiManagement/service/{}/skus", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}/refreshSecret", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.certificate_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5670,6 +13624,7 @@ pub mod api_management_service_skus { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); 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)?; @@ -5677,7 +13632,7 @@ pub mod api_management_service_skus { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ResourceSkuResults = + let rsp_value: models::CertificateContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -5696,37 +13651,20 @@ pub mod api_management_service_skus { } } } -pub mod api_management_service { +pub mod content_type { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn restore( - &self, - resource_group_name: impl Into, - service_name: impl Into, - parameters: impl Into, - subscription_id: impl Into, - ) -> restore::Builder { - restore::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn backup( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, subscription_id: impl Into, - ) -> backup::Builder { - backup::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - parameters: parameters.into(), subscription_id: subscription_id.into(), } } @@ -5734,12 +13672,14 @@ pub mod api_management_service { &self, resource_group_name: impl Into, service_name: impl Into, + content_type_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(), + content_type_id: content_type_id.into(), subscription_id: subscription_id.into(), } } @@ -5747,113 +13687,198 @@ pub mod api_management_service { &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + content_type_id: 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(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_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(), - service_name: service_name.into(), - parameters: parameters.into(), + content_type_id: content_type_id.into(), subscription_id: subscription_id.into(), + if_match: None, } } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, + content_type_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(), + content_type_id: content_type_id.into(), + if_match: if_match.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 mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), } - pub fn list(&self, subscription_id: impl Into) -> list::Builder { - list::Builder { - client: self.0.clone(), - subscription_id: subscription_id.into(), - } + #[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 fn get_sso_token( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> get_sso_token::Builder { - get_sso_token::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - subscription_id: subscription_id.into(), + impl Builder { + 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/{}/contentTypes", + 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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContentTypeCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 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 mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), } - pub fn get_domain_ownership_identifier(&self, subscription_id: impl Into) -> get_domain_ownership_identifier::Builder { - get_domain_ownership_identifier::Builder { - client: self.0.clone(), - subscription_id: subscription_id.into(), - } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) content_type_id: String, + pub(crate) subscription_id: String, } - pub fn apply_network_configuration_updates( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> apply_network_configuration_updates::Builder { - apply_network_configuration_updates::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - subscription_id: subscription_id.into(), - parameters: None, + impl Builder { + 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/{}/contentTypes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.content_type_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContentTypeContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 restore { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, + Created201(models::ContentTypeContract), + Ok200(models::ContentTypeContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5882,22 +13907,28 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, + pub(crate) content_type_id: String, 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/{}/restore", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.content_type_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5905,20 +13936,27 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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); + } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ContentTypeContract = + 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::ApiManagementServiceResource = + let rsp_value: models::ContentTypeContract = 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 = @@ -5933,12 +13971,12 @@ pub mod api_management_service { } } } - pub mod backup { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, + Ok200, + NoContent204, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5967,22 +14005,24 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, + pub(crate) content_type_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/{}/backup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.content_type_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -5990,20 +14030,15 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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.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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = - 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::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 = @@ -6018,7 +14053,99 @@ pub mod api_management_service { } } } - pub mod get { +} +pub mod content_item { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + content_type_id: 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(), + content_type_id: content_type_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + content_type_id: impl Into, + content_item_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(), + content_type_id: content_type_id.into(), + content_item_id: content_item_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + content_type_id: impl Into, + content_item_id: 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(), + content_type_id: content_type_id.into(), + content_item_id: content_item_id.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + content_type_id: impl Into, + content_item_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(), + content_type_id: content_type_id.into(), + content_item_id: content_item_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, + content_type_id: impl Into, + content_item_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(), + content_type_id: content_type_id.into(), + content_item_id: content_item_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6047,19 +14174,19 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) content_type_id: String, 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.ApiManagement/service/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.content_type_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -6079,7 +14206,7 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = + let rsp_value: models::ContentItemCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -6097,14 +14224,8 @@ pub mod api_management_service { } } } - pub mod create_or_update { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ApiManagementServiceResource), - Created201(models::ApiManagementServiceResource), - Accepted202, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6132,22 +14253,17 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceResource, + pub(crate) content_type_id: String, + pub(crate) content_item_id: String, 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.ApiManagement/service/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6155,8 +14271,7 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -6164,17 +14279,10 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceResource = - 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::ApiManagementServiceResource = + let rsp_value: models::ContentItemContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Created201(rsp_value)) + Ok(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 = @@ -6189,12 +14297,12 @@ pub mod api_management_service { } } } - pub mod update { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200(models::ApiManagementServiceResource), - Accepted202, + Created201(models::ContentItemContract), + Ok200(models::ContentItemContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6223,22 +14331,22 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::ApiManagementServiceUpdateParameters, + pub(crate) content_type_id: String, + pub(crate) content_item_id: String, 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/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6246,20 +14354,27 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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); + } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ContentItemContract = + 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::ApiManagementServiceResource = + let rsp_value: models::ContentItemContract = 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 = @@ -6279,7 +14394,6 @@ pub mod api_management_service { #[derive(Debug)] pub enum Response { Ok200, - Accepted202(models::ApiManagementServiceResource), NoContent204, } #[derive(Debug, thiserror :: Error)] @@ -6309,18 +14423,15 @@ pub mod api_management_service { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) content_type_id: String, + pub(crate) content_item_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/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_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); @@ -6331,6 +14442,7 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); + 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)?; @@ -6338,12 +14450,6 @@ pub mod api_management_service { 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::ApiManagementServiceResource = - 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)?; @@ -6359,7 +14465,7 @@ pub mod api_management_service { } } } - pub mod list_by_resource_group { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6387,22 +14493,18 @@ pub mod api_management_service { pub struct Builder { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) content_type_id: String, + pub(crate) content_item_id: String, 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<(), Error>> { Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6416,12 +14518,7 @@ pub mod api_management_service { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceListResult = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -6436,7 +14533,45 @@ pub mod api_management_service { } } } - pub mod list { +} +pub mod deleted_services { + use super::models; + 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 get_by_name( + &self, + service_name: impl Into, + subscription_id: impl Into, + location: impl Into, + ) -> get_by_name::Builder { + get_by_name::Builder { + client: self.0.clone(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + location: location.into(), + } + } + pub fn purge( + &self, + service_name: impl Into, + subscription_id: impl Into, + location: impl Into, + ) -> purge::Builder { + purge::Builder { + client: self.0.clone(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + location: location.into(), + } + } + } + pub mod list_by_subscription { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6466,12 +14601,10 @@ pub mod api_management_service { 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.ApiManagement/service", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/deletedservices", self.client.endpoint(), &self.subscription_id ); @@ -6493,7 +14626,7 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceListResult = + let rsp_value: models::DeletedServicesCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -6511,7 +14644,7 @@ pub mod api_management_service { } } } - pub mod get_sso_token { + pub mod get_by_name { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6538,26 +14671,23 @@ pub mod api_management_service { #[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) location: 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.ApiManagement/service/{}/getssotoken", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/locations/{}/deletedservices/{}", self.client.endpoint(), &self.subscription_id, - &self.resource_group_name, + &self.location, &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6566,7 +14696,6 @@ pub mod api_management_service { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); 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)?; @@ -6574,7 +14703,7 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceGetSsoTokenResult = + let rsp_value: models::DeletedServiceContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -6592,8 +14721,14 @@ pub mod api_management_service { } } } - pub mod check_name_availability { + pub mod purge { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::DeletedServiceContract), + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6619,23 +14754,23 @@ pub mod api_management_service { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) parameters: models::ApiManagementServiceCheckNameAvailabilityParameters, + pub(crate) service_name: String, pub(crate) subscription_id: String, + pub(crate) location: 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.ApiManagement/checkNameAvailability", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/locations/{}/deletedservices/{}", self.client.endpoint(), - &self.subscription_id + &self.subscription_id, + &self.location, + &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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6643,19 +14778,20 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { + 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::ApiManagementServiceNameAvailabilityResult = + let rsp_value: models::DeletedServiceContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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 = @@ -6670,7 +14806,16 @@ pub mod api_management_service { } } } - pub mod get_domain_ownership_identifier { +} +pub mod api_management_operations { + use super::models; + 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; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6697,24 +14842,14 @@ pub mod api_management_service { #[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, - > { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier", - self.client.endpoint(), - &self.subscription_id - ); + let url_str = &format!("{}/providers/Microsoft.ApiManagement/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::POST); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6723,7 +14858,6 @@ pub mod api_management_service { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); 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)?; @@ -6731,7 +14865,7 @@ pub mod api_management_service { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiManagementServiceGetDomainOwnershipIdentifierResult = + let rsp_value: models::OperationListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -6749,13 +14883,28 @@ pub mod api_management_service { } } } - pub mod apply_network_configuration_updates { - use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Ok200(models::ApiManagementServiceResource), +} +pub mod api_management_service_skus { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets available SKUs for API Management service"] + pub fn list_available_service_skus( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_available_service_skus::Builder { + list_available_service_skus::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } } + } + pub mod list_available_service_skus { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6784,19 +14933,20 @@ pub mod api_management_service { pub(crate) resource_group_name: String, pub(crate) 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> { + 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/{}/applynetworkconfigurationupdates" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/skus", + 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -6804,23 +14954,17 @@ pub mod api_management_service { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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 - }; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ApiManagementServiceResource = + let rsp_value: models::ResourceSkuResults = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -6837,38 +14981,50 @@ pub mod api_management_service { } } } -pub mod diagnostic { +pub mod api_management_service { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_service( + pub fn restore( &self, resource_group_name: impl Into, service_name: impl Into, + parameters: impl Into, subscription_id: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { + ) -> restore::Builder { + restore::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn backup( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> backup::Builder { + backup::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.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, - diagnostic_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(), - diagnostic_id: diagnostic_id.into(), subscription_id: subscription_id.into(), } } @@ -6876,36 +15032,29 @@ pub mod diagnostic { &self, resource_group_name: impl Into, service_name: impl Into, - diagnostic_id: impl Into, - parameters: 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(), - diagnostic_id: diagnostic_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), - if_match: None, } } pub fn update( &self, resource_group_name: impl Into, service_name: impl Into, - diagnostic_id: impl Into, - parameters: impl Into, - if_match: impl Into, + parameters: impl Into, subscription_id: impl Into, ) -> update::Builder { update::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - diagnostic_id: diagnostic_id.into(), parameters: parameters.into(), - if_match: if_match.into(), subscription_id: subscription_id.into(), } } @@ -6913,37 +15062,84 @@ pub mod diagnostic { &self, resource_group_name: impl Into, service_name: impl Into, - diagnostic_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(), - diagnostic_id: diagnostic_id.into(), - if_match: if_match.into(), subscription_id: subscription_id.into(), } } - pub fn get_entity_tag( + 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 fn get_sso_token( &self, resource_group_name: impl Into, service_name: impl Into, - diagnostic_id: impl Into, subscription_id: impl Into, - ) -> get_entity_tag::Builder { - get_entity_tag::Builder { + ) -> get_sso_token::Builder { + get_sso_token::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + 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 get_domain_ownership_identifier(&self, subscription_id: impl Into) -> get_domain_ownership_identifier::Builder { + get_domain_ownership_identifier::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn apply_network_configuration_updates( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> apply_network_configuration_updates::Builder { + apply_network_configuration_updates::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - diagnostic_id: diagnostic_id.into(), subscription_id: subscription_id.into(), + parameters: None, } } } - pub mod list_by_service { + pub mod restore { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6971,28 +15167,14 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, 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> { + 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/{}/diagnostics", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/restore", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -7000,7 +15182,7 @@ pub mod diagnostic { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7008,16 +15190,8 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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.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)?; @@ -7025,10 +15199,11 @@ pub mod diagnostic { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DiagnosticCollection = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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 = @@ -7043,8 +15218,13 @@ pub mod diagnostic { } } } - pub mod get { + pub mod backup { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7072,23 +15252,22 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, + pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, 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.ApiManagement/service/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backup", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7096,7 +15275,8 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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)?; @@ -7104,10 +15284,11 @@ pub mod diagnostic { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DiagnosticContract = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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 = @@ -7122,13 +15303,8 @@ pub mod diagnostic { } } } - pub mod create_or_update { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::DiagnosticContract), - Ok200(models::DiagnosticContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7156,29 +15332,23 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, - pub(crate) parameters: models::DiagnosticContract, 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> { + 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/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7186,27 +15356,17 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::DiagnosticContract = - 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::DiagnosticContract = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -7222,8 +15382,14 @@ pub mod diagnostic { } } } - pub mod update { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Created201(models::ApiManagementServiceResource), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7251,25 +15417,22 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, - pub(crate) parameters: models::DiagnosticContract, - pub(crate) if_match: String, + pub(crate) parameters: models::ApiManagementServiceResource, 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.ApiManagement/service/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7279,7 +15442,6 @@ pub mod diagnostic { url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); 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.header("If-Match", &self.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)?; @@ -7287,10 +15449,17 @@ pub mod diagnostic { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DiagnosticContract = + let rsp_value: models::ApiManagementServiceResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + 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::ApiManagementServiceResource = + 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 = @@ -7305,12 +15474,12 @@ pub mod diagnostic { } } } - pub mod delete { + pub mod update { use super::models; #[derive(Debug)] pub enum Response { - Ok200, - NoContent204, + Ok200(models::ApiManagementServiceResource), + Accepted202, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7339,24 +15508,22 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, - pub(crate) if_match: String, + pub(crate) parameters: models::ApiManagementServiceUpdateParameters, pub(crate) subscription_id: String, } impl Builder { 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/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7364,15 +15531,20 @@ pub mod diagnostic { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - req_builder = req_builder.header("If-Match", &self.if_match); - let req_body = azure_core::EMPTY_BODY; + 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::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceResource = + 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 = @@ -7387,8 +15559,14 @@ pub mod diagnostic { } } } - pub mod get_entity_tag { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::ApiManagementServiceResource), + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7416,23 +15594,21 @@ pub mod diagnostic { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) diagnostic_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/diagnostics/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.diagnostic_id + &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::HEAD); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7446,7 +15622,14 @@ pub mod diagnostic { let rsp = 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(()), + 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::ApiManagementServiceResource = + 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 = @@ -7461,113 +15644,7 @@ pub mod diagnostic { } } } -} -pub mod email_template { - use super::models; - 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, - template_name: 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(), - template_name: template_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - template_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(), - service_name: service_name.into(), - template_name: template_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - template_name: impl Into, - if_match: impl Into, - parameters: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - template_name: template_name.into(), - if_match: if_match.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - template_name: 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(), - template_name: template_name.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, - template_name: 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(), - template_name: template_name.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod list_by_resource_group { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7595,33 +15672,18 @@ pub mod email_template { 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> { + 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/{}/templates", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service", self.client.endpoint(), &self.subscription_id, - &self.resource_group_name, - &self.service_name + &self.resource_group_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -7633,15 +15695,6 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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)?; @@ -7650,7 +15703,7 @@ pub mod email_template { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateCollection = + let rsp_value: models::ApiManagementServiceListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -7668,7 +15721,7 @@ pub mod email_template { } } } - pub mod get { + pub mod list { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7695,21 +15748,17 @@ pub mod email_template { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) template_name: String, 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.ApiManagement/service/{}/templates/{}", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/service", self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.template_name + &self.subscription_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -7729,7 +15778,7 @@ pub mod email_template { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateContract = + let rsp_value: models::ApiManagementServiceListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -7747,13 +15796,8 @@ pub mod email_template { } } } - pub mod create_or_update { + pub mod get_sso_token { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::EmailTemplateContract), - Ok200(models::EmailTemplateContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7781,29 +15825,24 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, - pub(crate) parameters: models::EmailTemplateUpdateParameters, 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> { + 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/{}/templates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/getssotoken", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.template_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7811,27 +15850,18 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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); - } + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateContract = - 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::EmailTemplateContract = + let rsp_value: models::ApiManagementServiceGetSsoTokenResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -7847,7 +15877,7 @@ pub mod email_template { } } } - pub mod update { + pub mod check_name_availability { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7874,27 +15904,23 @@ pub mod email_template { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) template_name: String, - pub(crate) if_match: String, - pub(crate) parameters: models::EmailTemplateUpdateParameters, + pub(crate) parameters: models::ApiManagementServiceCheckNameAvailabilityParameters, 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.ApiManagement/service/{}/templates/{}", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/checkNameAvailability", self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.template_name + &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::PATCH); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7902,7 +15928,6 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - req_builder = req_builder.header("If-Match", &self.if_match); 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()); @@ -7912,7 +15937,7 @@ pub mod email_template { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::EmailTemplateContract = + let rsp_value: models::ApiManagementServiceNameAvailabilityResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -7930,13 +15955,8 @@ pub mod email_template { } } } - pub mod delete { + pub mod get_domain_ownership_identifier { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -7962,26 +15982,24 @@ pub mod email_template { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) template_name: 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> { + 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/{}/templates/{}", + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier", self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.template_name + &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::DELETE); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -7989,15 +16007,19 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - req_builder = req_builder.header("If-Match", &self.if_match); 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceGetDomainOwnershipIdentifierResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -8012,8 +16034,13 @@ pub mod email_template { } } } - pub mod get_entity_tag { + pub mod apply_network_configuration_updates { use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ApiManagementServiceResource), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8041,23 +16068,20 @@ pub mod email_template { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) template_name: String, pub(crate) subscription_id: String, + pub(crate) parameters: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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.ApiManagement/service/{}/templates/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.template_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/applynetworkconfigurationupdates" , 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::HEAD); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8065,13 +16089,24 @@ pub mod email_template { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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(()), + 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::ApiManagementServiceResource = + 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 = @@ -8087,7 +16122,7 @@ pub mod email_template { } } } -pub mod gateway { +pub mod diagnostic { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -8111,14 +16146,14 @@ pub mod gateway { &self, resource_group_name: impl Into, service_name: impl Into, - gateway_id: impl Into, + diagnostic_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(), - gateway_id: gateway_id.into(), + diagnostic_id: diagnostic_id.into(), subscription_id: subscription_id.into(), } } @@ -8126,15 +16161,15 @@ pub mod gateway { &self, resource_group_name: impl Into, service_name: impl Into, - gateway_id: impl Into, - parameters: impl Into, + diagnostic_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(), - gateway_id: gateway_id.into(), + diagnostic_id: diagnostic_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -8144,8 +16179,8 @@ pub mod gateway { &self, resource_group_name: impl Into, service_name: impl Into, - gateway_id: impl Into, - parameters: impl Into, + diagnostic_id: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -8153,7 +16188,7 @@ pub mod gateway { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - gateway_id: gateway_id.into(), + diagnostic_id: diagnostic_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), @@ -8163,7 +16198,7 @@ pub mod gateway { &self, resource_group_name: impl Into, service_name: impl Into, - gateway_id: impl Into, + diagnostic_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -8171,7 +16206,7 @@ pub mod gateway { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - gateway_id: gateway_id.into(), + diagnostic_id: diagnostic_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -8180,69 +16215,205 @@ pub mod gateway { &self, resource_group_name: impl Into, service_name: impl Into, - gateway_id: impl Into, + diagnostic_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(), - gateway_id: gateway_id.into(), + diagnostic_id: diagnostic_id.into(), subscription_id: subscription_id.into(), } } - pub fn list_keys( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - subscription_id: impl Into, - ) -> list_keys::Builder { - list_keys::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - gateway_id: gateway_id.into(), - subscription_id: subscription_id.into(), - } + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), } - pub fn regenerate_key( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: 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(), - service_name: service_name.into(), - gateway_id: gateway_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), + #[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/{}/diagnostics", + 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", "2021-04-01-preview"); + 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::DiagnosticCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 generate_token( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - parameters: impl Into, - subscription_id: impl Into, - ) -> generate_token::Builder { - generate_token::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - gateway_id: gateway_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), + } + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) diagnostic_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/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.diagnostic_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_service { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::DiagnosticContract), + Ok200(models::DiagnosticContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8270,36 +16441,29 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, + pub(crate) if_match: 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); + 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> { + 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/{}/gateways", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8307,26 +16471,27 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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()); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::DiagnosticContract = + 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::GatewayCollection = + let rsp_value: models::DiagnosticContract = 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)?; @@ -8342,7 +16507,7 @@ pub mod gateway { } } } - pub mod get { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8371,23 +16536,25 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + pub(crate) if_match: String, 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.ApiManagement/service/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8395,7 +16562,9 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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)?; @@ -8403,7 +16572,7 @@ pub mod gateway { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayContract = + let rsp_value: models::DiagnosticContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -8421,12 +16590,12 @@ pub mod gateway { } } } - pub mod create_or_update { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::GatewayContract), - Ok200(models::GatewayContract), + Ok200, + NoContent204, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8455,29 +16624,100 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) parameters: models::GatewayContract, + pub(crate) diagnostic_id: String, + pub(crate) if_match: String, 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/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.diagnostic_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", "2021-04-01-preview"); + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) diagnostic_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/{}/diagnostics/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.diagnostic_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8485,28 +16725,13 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::GatewayContract = - 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::GatewayContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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 = @@ -8521,7 +16746,113 @@ pub mod gateway { } } } - pub mod update { +} +pub mod email_template { + use super::models; + 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, + template_name: 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(), + template_name: template_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + template_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(), + service_name: service_name.into(), + template_name: template_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + template_name: impl Into, + if_match: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + template_name: template_name.into(), + if_match: if_match.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + template_name: 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(), + template_name: template_name.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, + template_name: 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(), + template_name: template_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8550,25 +16881,36 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) parameters: models::GatewayContract, - pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.gateway_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8576,9 +16918,16 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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.header("If-Match", &self.if_match); + 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)?; @@ -8586,7 +16935,7 @@ pub mod gateway { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayContract = + let rsp_value: models::EmailTemplateCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -8604,13 +16953,8 @@ pub mod gateway { } } } - pub mod delete { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8638,24 +16982,23 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) if_match: String, + pub(crate) template_name: String, 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.ApiManagement/service/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8663,15 +17006,18 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EmailTemplateContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -8686,8 +17032,13 @@ pub mod gateway { } } } - pub mod get_entity_tag { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::EmailTemplateContract), + Ok200(models::EmailTemplateContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8715,23 +17066,29 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, + pub(crate) template_name: String, + pub(crate) parameters: models::EmailTemplateUpdateParameters, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/gateways/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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::HEAD); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8739,13 +17096,28 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(()), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EmailTemplateContract = + 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::EmailTemplateContract = + 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 = @@ -8760,7 +17132,7 @@ pub mod gateway { } } } - pub mod list_keys { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8789,23 +17161,25 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, + pub(crate) template_name: String, + pub(crate) if_match: String, + pub(crate) parameters: models::EmailTemplateUpdateParameters, 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.ApiManagement/service/{}/gateways/{}/listKeys", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8813,8 +17187,9 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.header("If-Match", &self.if_match); + 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)?; @@ -8822,7 +17197,7 @@ pub mod gateway { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayKeysContract = + let rsp_value: models::EmailTemplateContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -8840,8 +17215,13 @@ pub mod gateway { } } } - pub mod regenerate_key { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8869,24 +17249,24 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) parameters: models::GatewayKeyRegenerationRequestContract, + pub(crate) template_name: 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<(), Error>> { + 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/{}/gateways/{}/regenerateKey", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8894,14 +17274,15 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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.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::NO_CONTENT => Ok(()), + 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 = @@ -8916,7 +17297,7 @@ pub mod gateway { } } } - pub mod generate_token { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8945,24 +17326,23 @@ pub mod gateway { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, - pub(crate) parameters: models::GatewayTokenRequestContract, + pub(crate) template_name: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/generateToken", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id + &self.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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -8970,19 +17350,13 @@ pub mod gateway { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayTokenContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -8998,7 +17372,7 @@ pub mod gateway { } } } -pub mod gateway_hostname_configuration { +pub mod gateway { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -9006,14 +17380,12 @@ pub mod gateway_hostname_configuration { &self, resource_group_name: impl Into, service_name: impl Into, - gateway_id: 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(), - gateway_id: gateway_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, @@ -9025,7 +17397,6 @@ pub mod gateway_hostname_configuration { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - hc_id: impl Into, subscription_id: impl Into, ) -> get::Builder { get::Builder { @@ -9033,7 +17404,6 @@ pub mod gateway_hostname_configuration { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - hc_id: hc_id.into(), subscription_id: subscription_id.into(), } } @@ -9042,8 +17412,7 @@ pub mod gateway_hostname_configuration { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - hc_id: impl Into, - parameters: impl Into, + parameters: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -9051,18 +17420,35 @@ pub mod gateway_hostname_configuration { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - hc_id: hc_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, } } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - hc_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -9071,7 +17457,6 @@ pub mod gateway_hostname_configuration { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - hc_id: hc_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -9081,7 +17466,6 @@ pub mod gateway_hostname_configuration { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - hc_id: impl Into, subscription_id: impl Into, ) -> get_entity_tag::Builder { get_entity_tag::Builder { @@ -9089,7 +17473,55 @@ pub mod gateway_hostname_configuration { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - hc_id: hc_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_keys( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + subscription_id: impl Into, + ) -> list_keys::Builder { + list_keys::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn regenerate_key( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: 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(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn generate_token( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> generate_token::Builder { + generate_token::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + parameters: parameters.into(), subscription_id: subscription_id.into(), } } @@ -9123,7 +17555,6 @@ pub mod gateway_hostname_configuration { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) gateway_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, @@ -9142,12 +17573,15 @@ pub mod gateway_hostname_configuration { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/gateways/{}/hostnameConfigurations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/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); @@ -9175,7 +17609,7 @@ pub mod gateway_hostname_configuration { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayHostnameConfigurationCollection = + let rsp_value: models::GatewayCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -9223,15 +17657,19 @@ pub mod gateway_hostname_configuration { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) hc_id: String, 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.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_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); @@ -9250,7 +17688,7 @@ pub mod gateway_hostname_configuration { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayHostnameConfigurationContract = + let rsp_value: models::GatewayContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -9272,8 +17710,8 @@ pub mod gateway_hostname_configuration { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::GatewayHostnameConfigurationContract), - Ok200(models::GatewayHostnameConfigurationContract), + Created201(models::GatewayContract), + Ok200(models::GatewayContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9303,8 +17741,7 @@ pub mod gateway_hostname_configuration { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) hc_id: String, - pub(crate) parameters: models::GatewayHostnameConfigurationContract, + pub(crate) parameters: models::GatewayContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -9315,7 +17752,14 @@ pub mod gateway_hostname_configuration { } 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/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_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); @@ -9326,11 +17770,11 @@ pub mod gateway_hostname_configuration { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); + 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.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)?; @@ -9338,13 +17782,13 @@ pub mod gateway_hostname_configuration { 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::GatewayHostnameConfigurationContract = + let rsp_value: models::GatewayContract = 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::GatewayHostnameConfigurationContract = + let rsp_value: models::GatewayContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -9362,13 +17806,8 @@ pub mod gateway_hostname_configuration { } } } - pub mod delete { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9397,17 +17836,24 @@ pub mod gateway_hostname_configuration { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) hc_id: String, + pub(crate) parameters: models::GatewayContract, pub(crate) if_match: String, 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.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9415,15 +17861,20 @@ pub mod gateway_hostname_configuration { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); + 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.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), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -9438,8 +17889,13 @@ pub mod gateway_hostname_configuration { } } } - pub mod get_entity_tag { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9468,16 +17924,23 @@ pub mod gateway_hostname_configuration { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) hc_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<(), Error>> { + 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/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9485,13 +17948,15 @@ pub mod gateway_hostname_configuration { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); + 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(()), + 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 = @@ -9506,83 +17971,7 @@ pub mod gateway_hostname_configuration { } } } -} -pub mod gateway_api { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_service( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: 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(), - gateway_id: gateway_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - api_id: 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(), - gateway_id: gateway_id.into(), - api_id: api_id.into(), - subscription_id: subscription_id.into(), - parameters: None, - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - api_id: 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(), - gateway_id: gateway_id.into(), - api_id: api_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn get_entity_tag( - &self, - resource_group_name: impl Into, - service_name: impl Into, - gateway_id: impl Into, - api_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(), - gateway_id: gateway_id.into(), - api_id: api_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9613,27 +18002,12 @@ pub mod gateway_api { pub(crate) service_name: String, pub(crate) gateway_id: 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> { + 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/{}/gateways/{}/apis", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -9642,7 +18016,7 @@ pub mod gateway_api { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9650,27 +18024,13 @@ pub mod gateway_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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::ApiCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -9685,13 +18045,8 @@ pub mod gateway_api { } } } - pub mod create_or_update { + pub mod list_keys { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ApiContract), - Ok200(models::ApiContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9720,29 +18075,22 @@ pub mod gateway_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) api_id: 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> { + 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/{}/gateways/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/listKeys", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id, - &self.api_id + &self.gateway_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9750,28 +18098,18 @@ pub mod gateway_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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 - }; + 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApiContract = - 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::ApiContract = + let rsp_value: models::GatewayKeysContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -9787,13 +18125,8 @@ pub mod gateway_api { } } } - pub mod delete { + pub mod regenerate_key { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -9822,24 +18155,23 @@ pub mod gateway_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) api_id: String, + pub(crate) parameters: models::GatewayKeyRegenerationRequestContract, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/regenerateKey", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id, - &self.api_id + &self.gateway_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9847,14 +18179,14 @@ pub mod gateway_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::NO_CONTENT => Ok(Response::NoContent204), + 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::ErrorResponse = @@ -9869,7 +18201,7 @@ pub mod gateway_api { } } } - pub mod get_entity_tag { + pub mod generate_token { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -9899,24 +18231,23 @@ pub mod gateway_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) api_id: String, + pub(crate) parameters: models::GatewayTokenRequestContract, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/gateways/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/generateToken", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.gateway_id, - &self.api_id + &self.gateway_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -9924,13 +18255,19 @@ pub mod gateway_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayTokenContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -9946,7 +18283,7 @@ pub mod gateway_api { } } } -pub mod gateway_certificate_authority { +pub mod gateway_hostname_configuration { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -9973,7 +18310,7 @@ pub mod gateway_certificate_authority { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - certificate_id: impl Into, + hc_id: impl Into, subscription_id: impl Into, ) -> get::Builder { get::Builder { @@ -9981,7 +18318,7 @@ pub mod gateway_certificate_authority { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - certificate_id: certificate_id.into(), + hc_id: hc_id.into(), subscription_id: subscription_id.into(), } } @@ -9990,8 +18327,8 @@ pub mod gateway_certificate_authority { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - certificate_id: impl Into, - parameters: impl Into, + hc_id: impl Into, + parameters: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -9999,7 +18336,7 @@ pub mod gateway_certificate_authority { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - certificate_id: certificate_id.into(), + hc_id: hc_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -10010,7 +18347,7 @@ pub mod gateway_certificate_authority { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - certificate_id: impl Into, + hc_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -10019,7 +18356,7 @@ pub mod gateway_certificate_authority { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - certificate_id: certificate_id.into(), + hc_id: hc_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -10029,7 +18366,7 @@ pub mod gateway_certificate_authority { resource_group_name: impl Into, service_name: impl Into, gateway_id: impl Into, - certificate_id: impl Into, + hc_id: impl Into, subscription_id: impl Into, ) -> get_entity_tag::Builder { get_entity_tag::Builder { @@ -10037,7 +18374,7 @@ pub mod gateway_certificate_authority { resource_group_name: resource_group_name.into(), service_name: service_name.into(), gateway_id: gateway_id.into(), - certificate_id: certificate_id.into(), + hc_id: hc_id.into(), subscription_id: subscription_id.into(), } } @@ -10092,10 +18429,10 @@ pub mod gateway_certificate_authority { } pub fn into_future( self, - ) -> futures::future::BoxFuture<'static, std::result::Result> + ) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_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); @@ -10123,7 +18460,7 @@ pub mod gateway_certificate_authority { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayCertificateAuthorityCollection = + let rsp_value: models::GatewayHostnameConfigurationCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -10171,15 +18508,15 @@ pub mod gateway_certificate_authority { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) certificate_id: String, + pub(crate) hc_id: String, pub(crate) subscription_id: String, } impl Builder { pub fn into_future( self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + ) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_id) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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); @@ -10198,7 +18535,7 @@ pub mod gateway_certificate_authority { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GatewayCertificateAuthorityContract = + let rsp_value: models::GatewayHostnameConfigurationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -10220,8 +18557,8 @@ pub mod gateway_certificate_authority { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::GatewayCertificateAuthorityContract), - Ok200(models::GatewayCertificateAuthorityContract), + Created201(models::GatewayHostnameConfigurationContract), + Ok200(models::GatewayHostnameConfigurationContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -10251,8 +18588,8 @@ pub mod gateway_certificate_authority { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) certificate_id: String, - pub(crate) parameters: models::GatewayCertificateAuthorityContract, + pub(crate) hc_id: String, + pub(crate) parameters: models::GatewayHostnameConfigurationContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -10263,7 +18600,7 @@ pub mod gateway_certificate_authority { } 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/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_id) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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); @@ -10286,13 +18623,13 @@ pub mod gateway_certificate_authority { 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::GatewayCertificateAuthorityContract = + let rsp_value: models::GatewayHostnameConfigurationContract = 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::GatewayCertificateAuthorityContract = + let rsp_value: models::GatewayHostnameConfigurationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -10345,14 +18682,14 @@ pub mod gateway_certificate_authority { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) certificate_id: String, + pub(crate) hc_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/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_id) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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); @@ -10416,13 +18753,13 @@ pub mod gateway_certificate_authority { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) gateway_id: String, - pub(crate) certificate_id: String, + pub(crate) hc_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/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_id) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_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); @@ -10455,7 +18792,7 @@ pub mod gateway_certificate_authority { } } } -pub mod group { +pub mod gateway_api { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -10463,84 +18800,52 @@ pub mod group { &self, resource_group_name: impl Into, service_name: impl Into, + gateway_id: 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(), + gateway_id: gateway_id.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, - group_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(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), - } - } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - parameters: impl Into, + gateway_id: impl Into, + api_id: 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(), - group_id: group_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - group_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - group_id: group_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), + gateway_id: gateway_id.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), + parameters: None, } } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - if_match: impl Into, + gateway_id: impl Into, + api_id: 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(), - group_id: group_id.into(), - if_match: if_match.into(), + gateway_id: gateway_id.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), } } @@ -10548,14 +18853,16 @@ pub mod group { &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, + gateway_id: impl Into, + api_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(), - group_id: group_id.into(), + gateway_id: gateway_id.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), } } @@ -10589,6 +18896,7 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) gateway_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, @@ -10607,14 +18915,15 @@ pub mod group { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/groups", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.gateway_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -10643,86 +18952,7 @@ pub mod group { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GroupCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) group_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/{}/groups/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.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", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GroupContract = + let rsp_value: models::ApiCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -10744,104 +18974,9 @@ pub mod group { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::GroupContract), - Ok200(models::GroupContract), - } - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) group_id: String, - pub(crate) parameters: models::GroupCreateParameters, - 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/{}/groups/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.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::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", "2021-04-01-preview"); - 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::GroupContract = - 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::GroupContract = - 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; + Created201(models::ApiContract), + Ok200(models::ApiContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -10869,25 +19004,30 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) parameters: models::GroupUpdateParameters, - pub(crate) if_match: String, + pub(crate) gateway_id: String, + pub(crate) api_id: String, pub(crate) subscription_id: String, + pub(crate) parameters: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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.ApiManagement/service/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.gateway_id, + &self.api_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -10895,19 +19035,28 @@ pub mod group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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.header("If-Match", &self.if_match); + 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::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiContract = + 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::GroupContract = + let rsp_value: models::ApiContract = 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)?; @@ -10957,20 +19106,21 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) if_match: String, + pub(crate) gateway_id: String, + pub(crate) api_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/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.gateway_id, + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -10982,7 +19132,6 @@ pub mod group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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)?; @@ -11034,19 +19183,21 @@ pub mod group { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, + pub(crate) gateway_id: String, + pub(crate) api_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/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.group_id + &self.gateway_id, + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -11080,81 +19231,103 @@ pub mod group { } } } -pub mod group_user { +pub mod gateway_certificate_authority { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, + gateway_id: impl Into, subscription_id: impl Into, - ) -> list::Builder { - list::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - group_id: group_id.into(), + gateway_id: gateway_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, } } - pub fn create( + pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - user_id: impl Into, + gateway_id: impl Into, + certificate_id: impl Into, subscription_id: impl Into, - ) -> create::Builder { - create::Builder { + ) -> get::Builder { + get::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - group_id: group_id.into(), - user_id: user_id.into(), + gateway_id: gateway_id.into(), + certificate_id: certificate_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + certificate_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(), + gateway_id: gateway_id.into(), + certificate_id: certificate_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, - group_id: impl Into, - user_id: impl Into, + gateway_id: impl Into, + certificate_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(), - group_id: group_id.into(), - user_id: user_id.into(), + gateway_id: gateway_id.into(), + certificate_id: certificate_id.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } - pub fn check_entity_exists( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, - group_id: impl Into, - user_id: impl Into, + gateway_id: impl Into, + certificate_id: impl Into, subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - group_id: group_id.into(), - user_id: user_id.into(), + gateway_id: gateway_id.into(), + certificate_id: certificate_id.into(), subscription_id: subscription_id.into(), } } } - pub mod list { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11183,7 +19356,7 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, + pub(crate) gateway_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, @@ -11202,16 +19375,12 @@ pub mod group_user { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/groups/{}/users", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_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); @@ -11239,7 +19408,7 @@ pub mod group_user { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::UserCollection = + let rsp_value: models::GatewayCertificateAuthorityCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -11257,12 +19426,87 @@ pub mod group_user { } } } - pub mod create { + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) gateway_id: String, + pub(crate) certificate_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/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayCertificateAuthorityContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; #[derive(Debug)] pub enum Response { - Created201(models::UserContract), - Ok200(models::UserContract), + Created201(models::GatewayCertificateAuthorityContract), + Ok200(models::GatewayCertificateAuthorityContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11291,22 +19535,20 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) user_id: String, + pub(crate) gateway_id: String, + pub(crate) certificate_id: String, + pub(crate) parameters: models::GatewayCertificateAuthorityContract, 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/{}/groups/{}/users/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id, - &self.user_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_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); @@ -11317,7 +19559,11 @@ pub mod group_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + 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)?; @@ -11325,13 +19571,13 @@ pub mod group_user { 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::UserContract = + let rsp_value: models::GatewayCertificateAuthorityContract = 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::UserContract = + let rsp_value: models::GatewayCertificateAuthorityContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -11383,22 +19629,15 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) user_id: String, + pub(crate) gateway_id: String, + pub(crate) certificate_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/{}/groups/{}/users/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id, - &self.user_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_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); @@ -11409,6 +19648,7 @@ pub mod group_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); + 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)?; @@ -11431,12 +19671,10 @@ pub mod group_user { } } } - pub mod check_entity_exists { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Error response #response_type")] - NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -11462,22 +19700,14 @@ pub mod group_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) group_id: String, - pub(crate) user_id: String, + pub(crate) gateway_id: String, + pub(crate) certificate_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/{}/groups/{}/users/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.group_id, - &self.user_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_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); @@ -11494,8 +19724,7 @@ pub mod group_user { let 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(()), - http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + 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 = @@ -11511,7 +19740,7 @@ pub mod group_user { } } } -pub mod identity_provider { +pub mod group { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -11526,20 +19755,23 @@ pub mod identity_provider { 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, - identity_provider_name: impl Into, + group_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(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -11547,15 +19779,15 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, - parameters: impl Into, + group_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(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -11565,8 +19797,8 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, - parameters: impl Into, + group_id: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -11574,7 +19806,7 @@ pub mod identity_provider { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), parameters: parameters.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), @@ -11584,7 +19816,7 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, + group_id: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -11592,7 +19824,7 @@ pub mod identity_provider { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -11601,35 +19833,205 @@ pub mod identity_provider { &self, resource_group_name: impl Into, service_name: impl Into, - identity_provider_name: impl Into, + group_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(), - identity_provider_name: identity_provider_name.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } - pub fn list_secrets( - &self, - resource_group_name: impl Into, - service_name: impl Into, - identity_provider_name: impl Into, - subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - identity_provider_name: identity_provider_name.into(), - subscription_id: subscription_id.into(), + } + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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/{}/groups", + 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", "2021-04-01-preview"); + 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::GroupCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) group_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/{}/groups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GroupContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_service { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::GroupContract), + Ok200(models::GroupContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -11657,21 +20059,29 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) group_id: String, + pub(crate) parameters: models::GroupCreateParameters, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/identityProviders", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11679,17 +20089,27 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::GroupContract = + 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::IdentityProviderList = + let rsp_value: models::GroupContract = 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)?; @@ -11705,7 +20125,7 @@ pub mod identity_provider { } } } - pub mod get { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11734,23 +20154,25 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, + pub(crate) group_id: String, + pub(crate) parameters: models::GroupUpdateParameters, + pub(crate) if_match: String, 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.ApiManagement/service/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11758,7 +20180,9 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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)?; @@ -11766,7 +20190,7 @@ pub mod identity_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IdentityProviderContract = + let rsp_value: models::GroupContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -11784,12 +20208,12 @@ pub mod identity_provider { } } } - pub mod create_or_update { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::IdentityProviderContract), - Ok200(models::IdentityProviderContract), + Ok200, + NoContent204, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11818,29 +20242,24 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, - pub(crate) parameters: models::IdentityProviderCreateContract, + pub(crate) group_id: String, + pub(crate) if_match: String, 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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.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::PUT); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11848,28 +20267,89 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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.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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IdentityProviderContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Created201(rsp_value)) - } - http::StatusCode::OK => { + 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::IdentityProviderContract = + let rsp_value: models::ErrorResponse = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) group_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/{}/groups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.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::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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 = @@ -11884,7 +20364,82 @@ pub mod identity_provider { } } } - pub mod update { +} +pub mod group_user { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn create( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + user_id: 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(), + group_id: group_id.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -11913,25 +20468,38 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, - pub(crate) parameters: models::IdentityProviderUpdateParameters, - pub(crate) if_match: String, + pub(crate) group_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.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::PATCH); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -11939,9 +20507,16 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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.header("If-Match", &self.if_match); + 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)?; @@ -11949,7 +20524,7 @@ pub mod identity_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IdentityProviderContract = + let rsp_value: models::UserCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -11967,12 +20542,12 @@ pub mod identity_provider { } } } - pub mod delete { + pub mod create { use super::models; #[derive(Debug)] pub enum Response { - Ok200, - NoContent204, + Created201(models::UserContract), + Ok200(models::UserContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12001,24 +20576,25 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, - pub(crate) if_match: String, + pub(crate) group_id: String, + pub(crate) user_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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.group_id, + &self.user_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12026,15 +20602,24 @@ pub mod identity_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UserContract = + 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::UserContract = + 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 = @@ -12049,8 +20634,13 @@ pub mod identity_provider { } } } - pub mod get_entity_tag { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12078,23 +20668,25 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, + pub(crate) group_id: String, + pub(crate) user_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/identityProviders/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.identity_provider_name + &self.group_id, + &self.user_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12108,7 +20700,8 @@ pub mod identity_provider { let rsp = 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(()), + 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 = @@ -12123,10 +20716,12 @@ pub mod identity_provider { } } } - pub mod list_secrets { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -12152,16 +20747,25 @@ pub mod identity_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) identity_provider_name: String, + pub(crate) group_id: String, + pub(crate) user_id: String, 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<(), Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . identity_provider_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.group_id, + &self.user_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12170,18 +20774,13 @@ pub mod identity_provider { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); 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::ClientSecretContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + http::StatusCode::NO_CONTENT => Ok(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -12197,7 +20796,7 @@ pub mod identity_provider { } } } -pub mod issue { +pub mod identity_provider { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -12212,28 +20811,186 @@ pub mod issue { 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, - issue_id: impl Into, + identity_provider_name: 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(), - issue_id: issue_id.into(), + identity_provider_name: identity_provider_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + identity_provider_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(), + service_name: service_name.into(), + identity_provider_name: identity_provider_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + identity_provider_name: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + identity_provider_name: identity_provider_name.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + identity_provider_name: 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(), + identity_provider_name: identity_provider_name.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, + identity_provider_name: 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(), + identity_provider_name: identity_provider_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + identity_provider_name: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + identity_provider_name: identity_provider_name.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_service { + pub mod list_by_service { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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, + } + impl Builder { + 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/{}/identityProviders", + 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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IdentityProviderList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12262,32 +21019,19 @@ pub mod issue { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) identity_provider_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> { + 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/{}/issues", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.identity_provider_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -12299,15 +21043,6 @@ pub mod issue { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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)?; @@ -12316,7 +21051,7 @@ pub mod issue { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::IssueCollection = + let rsp_value: models::IdentityProviderContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -12334,8 +21069,13 @@ pub mod issue { } } } - pub mod get { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::IdentityProviderContract), + Ok200(models::IdentityProviderContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12363,23 +21103,29 @@ pub mod issue { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) issue_id: String, + pub(crate) identity_provider_name: String, + pub(crate) parameters: models::IdentityProviderCreateContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/issues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.issue_id + &self.identity_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12387,17 +21133,27 @@ pub mod issue { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::IdentityProviderContract = + 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::IssueContract = + let rsp_value: models::IdentityProviderContract = 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)?; @@ -12413,113 +21169,7 @@ pub mod issue { } } } -} -pub mod logger { - use super::models; - 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, - logger_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(), - logger_id: logger_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - logger_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(), - logger_id: logger_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - logger_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - logger_id: logger_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - logger_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(), - logger_id: logger_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, - logger_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(), - logger_id: logger_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_service { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12548,36 +21198,25 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) identity_provider_name: String, + pub(crate) parameters: models::IdentityProviderUpdateParameters, + pub(crate) if_match: 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> { + 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/{}/loggers", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.identity_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12585,16 +21224,9 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.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)?; @@ -12602,7 +21234,7 @@ pub mod logger { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::LoggerCollection = + let rsp_value: models::IdentityProviderContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -12620,8 +21252,13 @@ pub mod logger { } } } - pub mod get { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12649,23 +21286,24 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, + pub(crate) identity_provider_name: 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> { + 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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.identity_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12673,18 +21311,15 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::LoggerContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -12699,13 +21334,8 @@ pub mod logger { } } } - pub mod create_or_update { + pub mod get_entity_tag { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::LoggerContract), - Ok200(models::LoggerContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12733,29 +21363,23 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, - pub(crate) parameters: models::LoggerContract, + pub(crate) identity_provider_name: String, 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> { + 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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.identity_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12763,28 +21387,13 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::LoggerContract = - 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::LoggerContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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 = @@ -12799,7 +21408,7 @@ pub mod logger { } } } - pub mod update { + pub mod list_secrets { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12828,25 +21437,16 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, - pub(crate) parameters: models::LoggerUpdateContract, - pub(crate) if_match: String, + pub(crate) identity_provider_name: String, 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.ApiManagement/service/{}/loggers/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.logger_id - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . identity_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::PATCH); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12854,9 +21454,8 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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.header("If-Match", &self.if_match); + 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)?; @@ -12864,7 +21463,7 @@ pub mod logger { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::LoggerContract = + let rsp_value: models::ClientSecretContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -12882,13 +21481,45 @@ pub mod logger { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, +} +pub mod issue { + use super::models; + 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, + issue_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(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + } } + } + pub mod list_by_service { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -12916,24 +21547,36 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, - pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/issues", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.logger_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -12941,15 +21584,27 @@ pub mod logger { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - req_builder = req_builder.header("If-Match", &self.if_match); + 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 => Ok(Response::Ok200), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -12964,7 +21619,7 @@ pub mod logger { } } } - pub mod get_entity_tag { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -12993,23 +21648,23 @@ pub mod logger { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) logger_id: String, + pub(crate) issue_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/loggers/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/issues/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.logger_id + &self.issue_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13023,7 +21678,12 @@ pub mod logger { let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -13039,7 +21699,7 @@ pub mod logger { } } } -pub mod named_value { +pub mod logger { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -13057,21 +21717,20 @@ pub mod named_value { filter: None, top: None, skip: None, - is_key_vault_refresh_failed: None, } } pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, - named_value_id: impl Into, + logger_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(), - named_value_id: named_value_id.into(), + logger_id: logger_id.into(), subscription_id: subscription_id.into(), } } @@ -13079,15 +21738,15 @@ pub mod named_value { &self, resource_group_name: impl Into, service_name: impl Into, - named_value_id: impl Into, - parameters: impl Into, + logger_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(), - named_value_id: named_value_id.into(), + logger_id: logger_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, @@ -13097,8 +21756,8 @@ pub mod named_value { &self, resource_group_name: impl Into, service_name: impl Into, - named_value_id: impl Into, - parameters: impl Into, + logger_id: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -13106,71 +21765,41 @@ pub mod named_value { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - named_value_id: named_value_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - named_value_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(), - named_value_id: named_value_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, - named_value_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(), - named_value_id: named_value_id.into(), + logger_id: logger_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } - pub fn list_value( + pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - named_value_id: impl Into, + logger_id: impl Into, + if_match: impl Into, subscription_id: impl Into, - ) -> list_value::Builder { - list_value::Builder { + ) -> delete::Builder { + delete::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - named_value_id: named_value_id.into(), + logger_id: logger_id.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } - pub fn refresh_secret( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, - named_value_id: impl Into, + logger_id: impl Into, subscription_id: impl Into, - ) -> refresh_secret::Builder { - refresh_secret::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - named_value_id: named_value_id.into(), + logger_id: logger_id.into(), subscription_id: subscription_id.into(), } } @@ -13208,7 +21837,6 @@ pub mod named_value { pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, - pub(crate) is_key_vault_refresh_failed: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -13223,14 +21851,10 @@ pub mod named_value { self.skip = Some(skip); self } - pub fn is_key_vault_refresh_failed(mut self, is_key_vault_refresh_failed: bool) -> Self { - self.is_key_vault_refresh_failed = Some(is_key_vault_refresh_failed); - self - } - 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.ApiManagement/service/{}/namedValues", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -13255,10 +21879,6 @@ pub mod named_value { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } - if let Some(is_key_vault_refresh_failed) = &self.is_key_vault_refresh_failed { - url.query_pairs_mut() - .append_pair("isKeyVaultRefreshFailed", &is_key_vault_refresh_failed.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)?; @@ -13267,7 +21887,7 @@ pub mod named_value { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NamedValueCollection = + let rsp_value: models::LoggerCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -13314,19 +21934,19 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, + pub(crate) logger_id: String, 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.ApiManagement/service/{}/namedValues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.named_value_id + &self.logger_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -13346,7 +21966,7 @@ pub mod named_value { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NamedValueContract = + let rsp_value: models::LoggerContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -13368,9 +21988,8 @@ pub mod named_value { use super::models; #[derive(Debug)] pub enum Response { - Accepted202, - Created201(models::NamedValueContract), - Ok200(models::NamedValueContract), + Created201(models::LoggerContract), + Ok200(models::LoggerContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13399,8 +22018,8 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, - pub(crate) parameters: models::NamedValueCreateContract, + pub(crate) logger_id: String, + pub(crate) parameters: models::LoggerContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -13412,12 +22031,12 @@ pub mod named_value { 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/{}/namedValues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.named_value_id + &self.logger_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -13439,16 +22058,15 @@ pub mod named_value { let 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::CREATED => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NamedValueContract = + let rsp_value: models::LoggerContract = 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::NamedValueContract = + let rsp_value: models::LoggerContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -13468,11 +22086,6 @@ pub mod named_value { } pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Ok200(models::NamedValueContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13500,21 +22113,21 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, - pub(crate) parameters: models::NamedValueUpdateParameters, + pub(crate) logger_id: String, + pub(crate) parameters: models::LoggerUpdateContract, pub(crate) if_match: String, 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.ApiManagement/service/{}/namedValues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.named_value_id + &self.logger_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -13534,12 +22147,11 @@ pub mod named_value { let 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::NamedValueContract = + let rsp_value: models::LoggerContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -13589,7 +22201,7 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, + pub(crate) logger_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -13597,12 +22209,12 @@ pub mod named_value { 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/{}/namedValues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.named_value_id + &self.logger_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -13666,19 +22278,19 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, + pub(crate) logger_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/{}/namedValues/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.named_value_id + &self.logger_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -13711,93 +22323,145 @@ pub mod named_value { } } } - pub mod list_value { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), +} +pub mod named_value { + use super::models; + 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, + is_key_vault_refresh_failed: None, + } } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) named_value_id: String, - pub(crate) subscription_id: String, + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_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(), + named_value_id: named_value_id.into(), + subscription_id: subscription_id.into(), + } } - impl Builder { - 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/{}/namedValues/{}/listValue", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.named_value_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", "2021-04-01-preview"); - 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::NamedValueSecretContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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 create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_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(), + named_value_id: named_value_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + named_value_id: named_value_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_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(), + named_value_id: named_value_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, + named_value_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(), + named_value_id: named_value_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_value( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_id: impl Into, + subscription_id: impl Into, + ) -> list_value::Builder { + list_value::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + named_value_id: named_value_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn refresh_secret( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_id: impl Into, + subscription_id: impl Into, + ) -> refresh_secret::Builder { + refresh_secret::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + named_value_id: named_value_id.into(), + subscription_id: subscription_id.into(), } } } - pub mod refresh_secret { + pub mod list_by_service { use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Ok200(models::NamedValueContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -13825,23 +22489,41 @@ pub mod named_value { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) named_value_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) is_key_vault_refresh_failed: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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 is_key_vault_refresh_failed(mut self, is_key_vault_refresh_failed: bool) -> Self { + self.is_key_vault_refresh_failed = Some(is_key_vault_refresh_failed); + 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/{}/namedValues/{}/refreshSecret", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.named_value_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -13849,19 +22531,30 @@ pub mod named_value { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); + 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()); + } + if let Some(is_key_vault_refresh_failed) = &self.is_key_vault_refresh_failed { + url.query_pairs_mut() + .append_pair("isKeyVaultRefreshFailed", &is_key_vault_refresh_failed.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::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::NamedValueContract = + let rsp_value: models::NamedValueCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -13877,41 +22570,7 @@ pub mod named_value { } } } -} -pub mod network_status { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_service( - &self, - subscription_id: impl Into, - resource_group_name: impl Into, - service_name: impl Into, - ) -> list_by_service::Builder { - list_by_service::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_by_location( - &self, - subscription_id: impl Into, - resource_group_name: impl Into, - service_name: impl Into, - location_name: impl Into, - ) -> list_by_location::Builder { - list_by_location::Builder { - client: self.0.clone(), - subscription_id: subscription_id.into(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - location_name: location_name.into(), - } - } - } - pub mod list_by_service { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -13938,21 +22597,21 @@ pub mod network_status { #[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) named_value_id: String, + pub(crate) subscription_id: String, } impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + 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/{}/networkstatus", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.named_value_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -13972,7 +22631,7 @@ pub mod network_status { 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 = + let rsp_value: models::NamedValueContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -13990,8 +22649,14 @@ pub mod network_status { } } } - pub mod list_by_location { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Created201(models::NamedValueContract), + Ok200(models::NamedValueContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -14017,25 +22682,31 @@ pub mod network_status { #[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) location_name: String, + pub(crate) named_value_id: String, + pub(crate) parameters: models::NamedValueCreateContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/locations/{}/networkstatus", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.location_name + &self.named_value_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14043,17 +22714,28 @@ pub mod network_status { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NamedValueContract = + 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::NetworkStatusContract = + let rsp_value: models::NamedValueContract = 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)?; @@ -14069,60 +22751,13 @@ pub mod network_status { } } } -} -pub mod notification { - use super::models; - 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(), - top: None, - skip: None, - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: 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(), - notification_name: notification_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_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(), - service_name: service_name.into(), - notification_name: notification_name.into(), - subscription_id: subscription_id.into(), - if_match: None, - } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::NamedValueContract), } - } - pub mod list_by_service { - use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -14150,31 +22785,25 @@ pub mod notification { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) named_value_id: String, + pub(crate) parameters: models::NamedValueUpdateParameters, + pub(crate) if_match: String, pub(crate) subscription_id: String, - pub(crate) top: Option, - pub(crate) skip: Option, } impl Builder { - 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> { + 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/{}/notifications", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.named_value_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14182,23 +22811,20 @@ pub mod notification { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.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::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::NotificationCollection = + let rsp_value: models::NamedValueContract = 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)?; @@ -14214,8 +22840,13 @@ pub mod notification { } } } - pub mod get { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -14243,23 +22874,24 @@ pub mod notification { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, + pub(crate) named_value_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> { + 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/{}/notifications/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.notification_name + &self.named_value_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14267,18 +22899,15 @@ pub mod notification { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NotificationContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -14293,7 +22922,7 @@ pub mod notification { } } } - pub mod create_or_update { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14322,28 +22951,23 @@ pub mod notification { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, + pub(crate) named_value_id: String, 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> { + 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/{}/notifications/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.notification_name + &self.named_value_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14351,21 +22975,13 @@ pub mod notification { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - if let Some(if_match) = &self.if_match { - req_builder = req_builder.header("If-Match", 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::NotificationContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -14380,79 +22996,7 @@ pub mod notification { } } } -} -pub mod notification_recipient_user { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_notification( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - subscription_id: impl Into, - ) -> list_by_notification::Builder { - list_by_notification::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - notification_name: notification_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - user_id: 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(), - notification_name: notification_name.into(), - user_id: user_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - user_id: 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(), - notification_name: notification_name.into(), - user_id: user_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn check_entity_exists( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - user_id: impl Into, - subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - notification_name: notification_name.into(), - user_id: user_id.into(), - subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_notification { + pub mod list_value { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14481,16 +23025,23 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, + pub(crate) named_value_id: String, 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.ApiManagement/service/{}/notifications/{}/recipientUsers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}/listValue", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14499,6 +23050,7 @@ pub mod notification_recipient_user { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); 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)?; @@ -14506,7 +23058,7 @@ pub mod notification_recipient_user { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientUserCollection = + let rsp_value: models::NamedValueSecretContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -14524,12 +23076,12 @@ pub mod notification_recipient_user { } } } - pub mod create_or_update { + pub mod refresh_secret { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::RecipientUserContract), - Ok200(models::RecipientUserContract), + Accepted202, + Ok200(models::NamedValueContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14558,17 +23110,23 @@ pub mod notification_recipient_user { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, - pub(crate) user_id: String, + pub(crate) named_value_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/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}/refreshSecret", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14577,20 +23135,16 @@ pub mod notification_recipient_user { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); 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::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientUserContract = - 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), http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientUserContract = + let rsp_value: models::NamedValueContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -14608,13 +23162,42 @@ pub mod notification_recipient_user { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, +} +pub mod network_status { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> list_by_service::Builder { + list_by_service::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_by_location( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + location_name: impl Into, + ) -> list_by_location::Builder { + list_by_location::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + location_name: location_name.into(), + } + } + } + pub mod list_by_service { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -14640,19 +23223,25 @@ pub mod notification_recipient_user { #[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) notification_name: String, - pub(crate) user_id: String, - 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, Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/networkstatus", + 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14666,8 +23255,12 @@ pub mod notification_recipient_user { let rsp = 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::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::ErrorResponse = @@ -14682,12 +23275,10 @@ pub mod notification_recipient_user { } } } - pub mod check_entity_exists { + pub mod list_by_location { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("Error response #response_type")] - NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -14711,19 +23302,25 @@ pub mod notification_recipient_user { #[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) notification_name: String, - pub(crate) user_id: String, - pub(crate) subscription_id: String, + pub(crate) location_name: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/locations/{}/networkstatus", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.location_name + ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14737,8 +23334,12 @@ pub mod notification_recipient_user { let 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(()), - http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkStatusContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -14754,78 +23355,58 @@ pub mod notification_recipient_user { } } } -pub mod notification_recipient_email { +pub mod notification { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_notification( - &self, - resource_group_name: impl Into, - service_name: impl Into, - notification_name: impl Into, - subscription_id: impl Into, - ) -> list_by_notification::Builder { - list_by_notification::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - notification_name: notification_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - notification_name: impl Into, - email: impl Into, subscription_id: impl Into, - ) -> create_or_update::Builder { - create_or_update::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - notification_name: notification_name.into(), - email: email.into(), subscription_id: subscription_id.into(), + top: None, + skip: None, } } - pub fn delete( + pub fn get( &self, resource_group_name: impl Into, service_name: impl Into, notification_name: impl Into, - email: impl Into, subscription_id: impl Into, - ) -> delete::Builder { - delete::Builder { + ) -> get::Builder { + get::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), notification_name: notification_name.into(), - email: email.into(), subscription_id: subscription_id.into(), } } - pub fn check_entity_exists( + pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, notification_name: impl Into, - email: impl Into, subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { + ) -> create_or_update::Builder { + create_or_update::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), notification_name: notification_name.into(), - email: email.into(), subscription_id: subscription_id.into(), + if_match: None, } } } - pub mod list_by_notification { + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -14854,13 +23435,28 @@ pub mod notification_recipient_email { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) notification_name: String, pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/notifications/{}/recipientEmails" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications", + 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); @@ -14871,6 +23467,12 @@ pub mod notification_recipient_email { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); + 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)?; @@ -14879,7 +23481,7 @@ pub mod notification_recipient_email { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::RecipientEmailCollection = + let rsp_value: models::NotificationCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -14897,13 +23499,8 @@ pub mod notification_recipient_email { } } } - pub mod create_or_update { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::RecipientEmailContract), - Ok200(models::RecipientEmailContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -14932,16 +23529,22 @@ pub mod notification_recipient_email { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) notification_name: String, - pub(crate) email: String, 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.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.notification_name + ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -14955,17 +23558,11 @@ pub mod notification_recipient_email { let 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::RecipientEmailContract = - 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::RecipientEmailContract = + let rsp_value: models::NotificationContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -14981,13 +23578,8 @@ pub mod notification_recipient_email { } } } - pub mod delete { + pub mod create_or_update { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15016,87 +23608,27 @@ pub mod notification_recipient_email { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) notification_name: String, - pub(crate) email: String, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - 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/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; - let mut url = 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", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = 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 fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self } - } - } - pub mod check_entity_exists { - use super::models; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("Error response #response_type")] - NotFound404 {}, - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, - #[error("Failed to parse request URL")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) notification_name: String, - pub(crate) email: String, - pub(crate) subscription_id: String, - } - impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.notification_name + ); let mut url = 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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15104,14 +23636,21 @@ pub mod notification_recipient_email { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", 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::NO_CONTENT => Ok(()), - http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NotificationContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -15127,38 +23666,22 @@ pub mod notification_recipient_email { } } } -pub mod open_id_connect_provider { +pub mod notification_recipient_user { use super::models; 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( + pub fn list_by_notification( &self, resource_group_name: impl Into, service_name: impl Into, - opid: impl Into, + notification_name: impl Into, subscription_id: impl Into, - ) -> get::Builder { - get::Builder { + ) -> list_by_notification::Builder { + list_by_notification::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - opid: opid.into(), + notification_name: notification_name.into(), subscription_id: subscription_id.into(), } } @@ -15166,36 +23689,16 @@ pub mod open_id_connect_provider { &self, resource_group_name: impl Into, service_name: impl Into, - opid: impl Into, - parameters: impl Into, + notification_name: impl Into, + user_id: 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(), - opid: opid.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - opid: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - opid: opid.into(), - parameters: parameters.into(), - if_match: if_match.into(), + notification_name: notification_name.into(), + user_id: user_id.into(), subscription_id: subscription_id.into(), } } @@ -15203,51 +23706,38 @@ pub mod open_id_connect_provider { &self, resource_group_name: impl Into, service_name: impl Into, - opid: impl Into, - if_match: impl Into, + notification_name: impl Into, + user_id: 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(), - opid: opid.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, - opid: 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(), - opid: opid.into(), + notification_name: notification_name.into(), + user_id: user_id.into(), subscription_id: subscription_id.into(), } } - pub fn list_secrets( + pub fn check_entity_exists( &self, resource_group_name: impl Into, service_name: impl Into, - opid: impl Into, + notification_name: impl Into, + user_id: impl Into, subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - opid: opid.into(), + notification_name: notification_name.into(), + user_id: user_id.into(), subscription_id: subscription_id.into(), } } } - pub mod list_by_service { + pub mod list_by_notification { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -15276,35 +23766,13 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) notification_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> { + 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/{}/openidConnectProviders", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::GET); @@ -15315,15 +23783,6 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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)?; @@ -15332,7 +23791,7 @@ pub mod open_id_connect_provider { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OpenIdConnectProviderCollection = + let rsp_value: models::RecipientUserCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -15350,8 +23809,13 @@ pub mod open_id_connect_provider { } } } - pub mod get { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::RecipientUserContract), + Ok200(models::RecipientUserContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15379,25 +23843,17 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, + pub(crate) notification_name: String, + pub(crate) user_id: String, 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.ApiManagement/service/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15411,11 +23867,17 @@ pub mod open_id_connect_provider { let 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::RecipientUserContract = + 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::OpenidConnectProviderContract = + let rsp_value: models::RecipientUserContract = 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)?; @@ -15431,12 +23893,12 @@ pub mod open_id_connect_provider { } } } - pub mod create_or_update { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::OpenidConnectProviderContract), - Ok200(models::OpenidConnectProviderContract), + Ok200, + NoContent204, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -15465,29 +23927,17 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, - pub(crate) parameters: models::OpenidConnectProviderContract, + pub(crate) notification_name: String, + pub(crate) user_id: String, 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/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15495,28 +23945,14 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::OpenidConnectProviderContract = - 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::OpenidConnectProviderContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } + 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 = @@ -15531,10 +23967,12 @@ pub mod open_id_connect_provider { } } } - pub mod update { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -15560,27 +23998,17 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, - pub(crate) parameters: models::OpenidConnectProviderUpdateContract, - pub(crate) if_match: String, + pub(crate) notification_name: String, + pub(crate) user_id: String, 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<(), Error>> { Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15588,20 +24016,14 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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.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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OpenidConnectProviderContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + http::StatusCode::NO_CONTENT => Ok(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -15616,13 +24038,80 @@ pub mod open_id_connect_provider { } } } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - NoContent204, +} +pub mod notification_recipient_email { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_notification( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + subscription_id: impl Into, + ) -> list_by_notification::Builder { + list_by_notification::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + email: 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(), + notification_name: notification_name.into(), + email: email.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + email: 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(), + notification_name: notification_name.into(), + email: email.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + email: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + email: email.into(), + subscription_id: subscription_id.into(), + } } + } + pub mod list_by_notification { + use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15650,24 +24139,16 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, - pub(crate) if_match: String, + pub(crate) notification_name: String, 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.ApiManagement/service/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15675,15 +24156,18 @@ pub mod open_id_connect_provider { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecipientEmailCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -15698,8 +24182,13 @@ pub mod open_id_connect_provider { } } } - pub mod get_entity_tag { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::RecipientEmailContract), + Ok200(models::RecipientEmailContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15727,23 +24216,17 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, + pub(crate) notification_name: String, + pub(crate) email: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/openidConnectProviders/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.opid - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; let mut url = 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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15757,7 +24240,18 @@ pub mod open_id_connect_provider { let rsp = 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(()), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecipientEmailContract = + 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::RecipientEmailContract = + 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 = @@ -15772,8 +24266,13 @@ pub mod open_id_connect_provider { } } } - pub mod list_secrets { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -15801,16 +24300,17 @@ pub mod open_id_connect_provider { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) opid: String, + pub(crate) notification_name: String, + pub(crate) email: String, 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.ApiManagement/service/{}/openidConnectProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . opid) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15819,18 +24319,13 @@ pub mod open_id_connect_provider { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); 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::ClientSecretContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -15845,29 +24340,12 @@ pub mod open_id_connect_provider { } } } -} -pub mod outbound_network_dependencies_endpoints { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_service( - &self, - subscription_id: impl Into, - resource_group_name: impl Into, - service_name: impl Into, - ) -> list_by_service::Builder { - list_by_service::Builder { - client: self.0.clone(), - subscription_id: subscription_id.into(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - } - } - } - pub mod list_by_service { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, #[error("HTTP status code {}", status_code)] DefaultResponse { status_code: http::StatusCode, @@ -15891,19 +24369,19 @@ pub mod outbound_network_dependencies_endpoints { #[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) notification_name: String, + pub(crate) email: String, + 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<(), Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/outboundNetworkDependenciesEndpoints" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -15917,12 +24395,8 @@ pub mod outbound_network_dependencies_endpoints { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::OutboundEnvironmentEndpointList = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + http::StatusCode::NO_CONTENT => Ok(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = @@ -15938,7 +24412,7 @@ pub mod outbound_network_dependencies_endpoints { } } } -pub mod policy { +pub mod open_id_connect_provider { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -15953,47 +24427,68 @@ pub mod policy { 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, - policy_id: impl Into, + opid: 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(), - policy_id: policy_id.into(), + opid: opid.into(), subscription_id: subscription_id.into(), - format: None, } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, - parameters: impl Into, + opid: 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(), - policy_id: policy_id.into(), + opid: opid.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), if_match: None, } } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + opid: opid.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, + opid: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { @@ -16001,7 +24496,7 @@ pub mod policy { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - policy_id: policy_id.into(), + opid: opid.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -16010,14 +24505,29 @@ pub mod policy { &self, resource_group_name: impl Into, service_name: impl Into, - policy_id: impl Into, + opid: 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(), - policy_id: policy_id.into(), + opid: opid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + opid: opid.into(), subscription_id: subscription_id.into(), } } @@ -16052,12 +24562,29 @@ pub mod policy { 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 into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/policies", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -16073,6 +24600,15 @@ pub mod policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); + 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)?; @@ -16081,7 +24617,7 @@ pub mod policy { match 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 = + let rsp_value: models::OpenIdConnectProviderCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -16128,24 +24664,21 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, + pub(crate) opid: String, pub(crate) subscription_id: String, - pub(crate) format: Option, } impl Builder { - pub fn format(mut self, format: impl Into) -> Self { - self.format = Some(format.into()); - self - } - 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.ApiManagement/service/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.policy_id + &self.opid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -16157,9 +24690,6 @@ pub mod policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - if let Some(format) = &self.format { - url.query_pairs_mut().append_pair("format", format); - } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -16168,7 +24698,7 @@ pub mod policy { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PolicyContract = + let rsp_value: models::OpenidConnectProviderContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -16190,8 +24720,8 @@ pub mod policy { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::PolicyContract), - Ok200(models::PolicyContract), + Created201(models::OpenidConnectProviderContract), + Ok200(models::OpenidConnectProviderContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -16220,8 +24750,8 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, - pub(crate) parameters: models::PolicyContract, + pub(crate) opid: String, + pub(crate) parameters: models::OpenidConnectProviderContract, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -16233,12 +24763,12 @@ pub mod policy { 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/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.policy_id + &self.opid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -16262,13 +24792,13 @@ pub mod policy { 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::PolicyContract = + let rsp_value: models::OpenidConnectProviderContract = 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::PolicyContract = + let rsp_value: models::OpenidConnectProviderContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -16286,6 +24816,91 @@ pub mod policy { } } } + pub mod update { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) opid: String, + pub(crate) parameters: models::OpenidConnectProviderUpdateContract, + 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/{}/openidConnectProviders/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.opid + ); + let mut url = 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", "2021-04-01-preview"); + 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.header("If-Match", &self.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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenidConnectProviderContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; #[derive(Debug)] @@ -16320,7 +24935,7 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, + pub(crate) opid: String, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -16328,12 +24943,12 @@ pub mod policy { 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/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.policy_id + &self.opid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -16397,19 +25012,19 @@ pub mod policy { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) policy_id: String, + pub(crate) opid: 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/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.policy_id + &self.opid ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -16442,23 +25057,95 @@ pub mod policy { } } } + pub mod list_secrets { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) opid: 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/{}/openidConnectProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . opid) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); + 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::ClientSecretContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 policy_description { +pub mod outbound_network_dependencies_endpoints { use super::models; pub struct Client(pub(crate) super::Client); impl Client { pub fn list_by_service( &self, + subscription_id: impl Into, 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(), + subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - subscription_id: subscription_id.into(), - scope: None, } } } @@ -16489,27 +25176,16 @@ pub mod policy_description { #[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) subscription_id: String, - pub(crate) scope: Option, } impl Builder { - pub fn scope(mut self, scope: impl Into) -> Self { - self.scope = Some(scope.into()); - self - } pub fn into_future( self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + ) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policyDescriptions", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/outboundNetworkDependenciesEndpoints" , 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); @@ -16520,9 +25196,6 @@ pub mod policy_description { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - if let Some(scope) = &self.scope { - url.query_pairs_mut().append_pair("scope", scope); - } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -16531,7 +25204,7 @@ pub mod policy_description { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PolicyDescriptionCollection = + let rsp_value: models::OutboundEnvironmentEndpointList = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -16550,7 +25223,7 @@ pub mod policy_description { } } } -pub mod portal_revision { +pub mod policy { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -16565,58 +25238,55 @@ pub mod portal_revision { 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, - portal_revision_id: impl Into, + policy_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(), - portal_revision_id: portal_revision_id.into(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), + format: None, } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - portal_revision_id: impl Into, - parameters: impl Into, + policy_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(), - portal_revision_id: portal_revision_id.into(), + policy_id: policy_id.into(), parameters: parameters.into(), subscription_id: subscription_id.into(), + if_match: None, } } - pub fn update( + pub fn delete( &self, resource_group_name: impl Into, service_name: impl Into, - portal_revision_id: impl Into, - parameters: impl Into, + policy_id: impl Into, if_match: impl Into, subscription_id: impl Into, - ) -> update::Builder { - update::Builder { + ) -> delete::Builder { + delete::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - portal_revision_id: portal_revision_id.into(), - parameters: parameters.into(), + policy_id: policy_id.into(), if_match: if_match.into(), subscription_id: subscription_id.into(), } @@ -16625,14 +25295,14 @@ pub mod portal_revision { &self, resource_group_name: impl Into, service_name: impl Into, - portal_revision_id: impl Into, + policy_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(), - portal_revision_id: portal_revision_id.into(), + policy_id: policy_id.into(), subscription_id: subscription_id.into(), } } @@ -16667,208 +25337,20 @@ pub mod portal_revision { 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/{}/portalRevisions", - 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", "2021-04-01-preview"); - 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::PortalRevisionCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) portal_revision_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/{}/portalRevisions/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.portal_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", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalRevisionContract = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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; - #[derive(Debug)] - pub enum Response { - Accepted202, - Created201(models::PortalRevisionContract), - } - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) portal_revision_id: String, - pub(crate) parameters: models::PortalRevisionContract, - 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.ApiManagement/service/{}/portalRevisions/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.portal_revision_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16876,19 +25358,17 @@ pub mod portal_revision { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::CREATED => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalRevisionContract = + let rsp_value: models::PolicyCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Created201(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -16904,13 +25384,8 @@ pub mod portal_revision { } } } - pub mod update { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Accepted202, - Ok200(models::PortalRevisionContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -16938,25 +25413,28 @@ pub mod portal_revision { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) portal_revision_id: String, - pub(crate) parameters: models::PortalRevisionContract, - pub(crate) if_match: String, + pub(crate) policy_id: String, pub(crate) subscription_id: String, + pub(crate) format: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.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/{}/portalRevisions/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.portal_revision_id + &self.policy_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -16964,20 +25442,20 @@ pub mod portal_revision { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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.header("If-Match", &self.if_match); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::PortalRevisionContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -16993,8 +25471,13 @@ pub mod portal_revision { } } } - pub mod get_entity_tag { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -17022,23 +25505,29 @@ pub mod portal_revision { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) portal_revision_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/portalRevisions/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.portal_revision_id + &self.policy_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17046,13 +25535,28 @@ pub mod portal_revision { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(()), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + 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::PolicyContract = + 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 = @@ -17067,27 +25571,13 @@ pub mod portal_revision { } } } -} -pub mod portal_settings { - use super::models; - 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(), - } - } - } - pub mod list_by_service { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -17115,21 +25605,24 @@ pub mod portal_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) policy_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> { + 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/{}/portalsettings", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17137,18 +25630,15 @@ pub mod portal_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); + 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 => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSettingsCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -17163,72 +25653,7 @@ pub mod portal_settings { } } } -} -pub mod sign_in_settings { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - resource_group_name: impl Into, - service_name: 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(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - 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(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - parameters: parameters.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, - 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(), - subscription_id: subscription_id.into(), - } - } - } - pub mod get { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17257,21 +25682,23 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) policy_id: String, 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.policy_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17285,12 +25712,7 @@ pub mod sign_in_settings { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSigninSettings = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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 = @@ -17305,7 +25727,27 @@ pub mod sign_in_settings { } } } - pub mod create_or_update { +} +pub mod policy_description { + use super::models; + 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(), + scope: None, + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17334,19 +25776,20 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSigninSettings, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) scope: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + pub fn scope(mut self, scope: impl Into) -> Self { + self.scope = Some(scope.into()); self } - 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.ApiManagement/service/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policyDescriptions", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -17354,7 +25797,7 @@ pub mod sign_in_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17362,11 +25805,10 @@ pub mod sign_in_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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); + if let Some(scope) = &self.scope { + url.query_pairs_mut().append_pair("scope", scope); } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -17374,7 +25816,7 @@ pub mod sign_in_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSigninSettings = + let rsp_value: models::PolicyDescriptionCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -17392,7 +25834,95 @@ pub mod sign_in_settings { } } } - pub mod update { +} +pub mod portal_revision { + use super::models; + 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, + portal_revision_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(), + portal_revision_id: portal_revision_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + portal_revision_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(), + portal_revision_id: portal_revision_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + portal_revision_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + portal_revision_id: portal_revision_id.into(), + parameters: parameters.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, + portal_revision_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(), + portal_revision_id: portal_revision_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17421,15 +25951,28 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSigninSettings, - pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -17437,7 +25980,7 @@ pub mod sign_in_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17445,15 +25988,27 @@ pub mod sign_in_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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.header("If-Match", &self.if_match); + 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::NO_CONTENT => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalRevisionCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -17468,7 +26023,7 @@ pub mod sign_in_settings { } } } - pub mod get_entity_tag { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17497,21 +26052,23 @@ pub mod sign_in_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) portal_revision_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/portalsettings/signin", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.portal_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::HEAD); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17525,7 +26082,12 @@ pub mod sign_in_settings { let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalRevisionContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -17540,73 +26102,13 @@ pub mod sign_in_settings { } } } -} -pub mod sign_up_settings { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - resource_group_name: impl Into, - service_name: 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(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - 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(), - service_name: service_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - parameters: parameters.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, - 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(), - subscription_id: subscription_id.into(), - } - } - } - pub mod get { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Created201(models::PortalRevisionContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -17634,21 +26136,24 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) portal_revision_id: String, + pub(crate) parameters: models::PortalRevisionContract, 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.ApiManagement/service/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.portal_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17656,17 +26161,19 @@ pub mod sign_up_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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 => { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::CREATED => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSignupSettings = + let rsp_value: models::PortalRevisionContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + Ok(Response::Created201(rsp_value)) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -17682,8 +26189,13 @@ pub mod sign_up_settings { } } } - pub mod create_or_update { + pub mod update { use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::PortalRevisionContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -17711,27 +26223,25 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSignupSettings, + pub(crate) portal_revision_id: String, + pub(crate) parameters: models::PortalRevisionContract, + pub(crate) if_match: String, 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> { + 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/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.portal_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::PUT); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17741,19 +26251,18 @@ pub mod sign_up_settings { url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); 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.header("If-Match", &self.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::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::PortalSignupSettings = + let rsp_value: models::PortalRevisionContract = 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)?; @@ -17769,7 +26278,7 @@ pub mod sign_up_settings { } } } - pub mod update { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17798,23 +26307,23 @@ pub mod sign_up_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalSignupSettings, - pub(crate) if_match: String, + pub(crate) portal_revision_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/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.portal_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::PATCH); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17822,15 +26331,13 @@ pub mod sign_up_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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.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::NO_CONTENT => Ok(()), + 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 = @@ -17845,7 +26352,26 @@ pub mod sign_up_settings { } } } - pub mod get_entity_tag { +} +pub mod portal_settings { + use super::models; + 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(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -17877,10 +26403,10 @@ pub mod sign_up_settings { pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/portalsettings/signup", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -17888,7 +26414,7 @@ pub mod sign_up_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -17902,7 +26428,12 @@ pub mod sign_up_settings { let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalSettingsCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -17918,7 +26449,7 @@ pub mod sign_up_settings { } } } -pub mod delegation_settings { +pub mod sign_in_settings { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -17939,7 +26470,7 @@ pub mod delegation_settings { &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + parameters: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -17955,7 +26486,7 @@ pub mod delegation_settings { &self, resource_group_name: impl Into, service_name: impl Into, - parameters: impl Into, + parameters: impl Into, if_match: impl Into, subscription_id: impl Into, ) -> update::Builder { @@ -17981,19 +26512,6 @@ pub mod delegation_settings { subscription_id: subscription_id.into(), } } - pub fn list_secrets( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> list_secrets::Builder { - list_secrets::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - subscription_id: subscription_id.into(), - } - } } pub mod get { use super::models; @@ -18027,10 +26545,10 @@ pub mod delegation_settings { 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.ApiManagement/service/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -18054,7 +26572,7 @@ pub mod delegation_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalDelegationSettings = + let rsp_value: models::PortalSigninSettings = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -18101,7 +26619,7 @@ pub mod delegation_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalDelegationSettings, + pub(crate) parameters: models::PortalSigninSettings, pub(crate) subscription_id: String, pub(crate) if_match: Option, } @@ -18110,10 +26628,10 @@ pub mod delegation_settings { self.if_match = Some(if_match.into()); self } - 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.ApiManagement/service/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -18141,7 +26659,7 @@ pub mod delegation_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalDelegationSettings = + let rsp_value: models::PortalSigninSettings = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -18188,7 +26706,7 @@ pub mod delegation_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) parameters: models::PortalDelegationSettings, + pub(crate) parameters: models::PortalSigninSettings, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -18196,7 +26714,7 @@ pub mod delegation_settings { 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/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -18235,7 +26753,144 @@ pub mod delegation_settings { } } } - pub mod get_entity_tag { + pub mod get_entity_tag { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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, + } + 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/{}/portalsettings/signin", + 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::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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 sign_up_settings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + service_name: 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(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + 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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.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, + 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(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18267,10 +26922,10 @@ pub mod delegation_settings { pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/portalsettings/delegation", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -18278,7 +26933,7 @@ pub mod delegation_settings { ); let mut url = 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18292,7 +26947,12 @@ pub mod delegation_settings { let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalSignupSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -18307,7 +26967,7 @@ pub mod delegation_settings { } } } - pub mod list_secrets { + pub mod create_or_update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18336,17 +26996,27 @@ pub mod delegation_settings { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) parameters: models::PortalSignupSettings, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/portalsettings/delegation/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", + 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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18354,8 +27024,11 @@ pub mod delegation_settings { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + 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)?; @@ -18363,7 +27036,7 @@ pub mod delegation_settings { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PortalSettingValidationKeyContract = + let rsp_value: models::PortalSignupSettings = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -18381,101 +27054,7 @@ pub mod delegation_settings { } } } -} -pub mod private_endpoint_connection { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_service( - &self, - subscription_id: impl Into, - resource_group_name: impl Into, - service_name: impl Into, - ) -> list_by_service::Builder { - list_by_service::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_by_name( - &self, - resource_group_name: impl Into, - service_name: impl Into, - private_endpoint_connection_name: impl Into, - subscription_id: impl Into, - ) -> get_by_name::Builder { - get_by_name::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - private_endpoint_connection_name: private_endpoint_connection_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - private_endpoint_connection_name: impl Into, - subscription_id: impl Into, - private_endpoint_connection_request: 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(), - private_endpoint_connection_name: private_endpoint_connection_name.into(), - subscription_id: subscription_id.into(), - private_endpoint_connection_request: private_endpoint_connection_request.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - private_endpoint_connection_name: 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(), - private_endpoint_connection_name: private_endpoint_connection_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_private_link_resources( - &self, - resource_group_name: impl Into, - subscription_id: impl Into, - service_name: impl Into, - ) -> list_private_link_resources::Builder { - list_private_link_resources::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - service_name: service_name.into(), - } - } - pub fn get_private_link_resource( - &self, - resource_group_name: impl Into, - subscription_id: impl Into, - service_name: impl Into, - private_link_sub_resource_name: impl Into, - ) -> get_private_link_resource::Builder { - get_private_link_resource::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - subscription_id: subscription_id.into(), - service_name: service_name.into(), - private_link_sub_resource_name: private_link_sub_resource_name.into(), - } - } - } - pub mod list_by_service { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18502,17 +27081,17 @@ pub mod private_endpoint_connection { #[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) parameters: models::PortalSignupSettings, + pub(crate) if_match: String, + 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/privateEndpointConnections", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -18520,7 +27099,7 @@ pub mod private_endpoint_connection { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18528,18 +27107,15 @@ pub mod private_endpoint_connection { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::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) - } + 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::ErrorResponse = @@ -18554,7 +27130,7 @@ pub mod private_endpoint_connection { } } } - pub mod get_by_name { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18583,23 +27159,21 @@ pub mod private_endpoint_connection { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_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> { + 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/{}/privateEndpointConnections/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.private_endpoint_connection_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18613,12 +27187,7 @@ pub mod private_endpoint_connection { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match 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) - } + 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 = @@ -18633,13 +27202,86 @@ pub mod private_endpoint_connection { } } } - pub mod create_or_update { +} +pub mod delegation_settings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + service_name: 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(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + 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(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.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, + 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(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Created201, - Ok200(models::PrivateEndpointConnection), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -18667,24 +27309,21 @@ pub mod private_endpoint_connection { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) private_endpoint_connection_name: String, pub(crate) subscription_id: String, - pub(crate) private_endpoint_connection_request: models::PrivateEndpointConnectionRequest, } 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.ApiManagement/service/{}/privateEndpointConnections/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.private_endpoint_connection_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18692,19 +27331,17 @@ pub mod private_endpoint_connection { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.private_endpoint_connection_request).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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 => Ok(Response::Created201), http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PrivateEndpointConnection = + let rsp_value: models::PortalDelegationSettings = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -18720,14 +27357,8 @@ pub mod private_endpoint_connection { } } } - pub mod delete { + pub mod create_or_update { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - NoContent204, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -18755,23 +27386,27 @@ pub mod private_endpoint_connection { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) private_endpoint_connection_name: String, + pub(crate) parameters: models::PortalDelegationSettings, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/privateEndpointConnections/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.private_endpoint_connection_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18779,15 +27414,22 @@ pub mod private_endpoint_connection { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalDelegationSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 = @@ -18802,7 +27444,7 @@ pub mod private_endpoint_connection { } } } - pub mod list_private_link_resources { + pub mod update { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18830,16 +27472,16 @@ pub mod private_endpoint_connection { pub struct Builder { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, pub(crate) service_name: String, + pub(crate) parameters: models::PortalDelegationSettings, + pub(crate) if_match: String, + 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/privateLinkResources", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -18847,7 +27489,7 @@ pub mod private_endpoint_connection { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18855,18 +27497,15 @@ pub mod private_endpoint_connection { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::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) - } + 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::ErrorResponse = @@ -18881,7 +27520,7 @@ pub mod private_endpoint_connection { } } } - pub mod get_private_link_resource { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -18909,24 +27548,22 @@ pub mod private_endpoint_connection { pub struct Builder { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, - pub(crate) subscription_id: String, pub(crate) service_name: String, - pub(crate) private_link_sub_resource_name: String, + 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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/privateLinkResources/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.private_link_sub_resource_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); + req_builder = req_builder.method(http::Method::HEAD); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -18940,153 +27577,22 @@ pub mod private_endpoint_connection { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match 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) - } + 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 product { - use super::models; - 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, - expand_groups: None, - tags: None, - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_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(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_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(), - product_id: product_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_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(), - product_id: product_id.into(), - if_match: if_match.into(), - subscription_id: subscription_id.into(), - delete_subscriptions: None, - } - } - pub fn get_entity_tag( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_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(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_by_tags( - &self, - resource_group_name: impl Into, - service_name: impl Into, - subscription_id: impl Into, - ) -> list_by_tags::Builder { - list_by_tags::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, - include_not_tagged_products: None, + 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_service { + pub mod list_secrets { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -19116,45 +27622,16 @@ pub mod product { 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, - pub(crate) expand_groups: Option, - pub(crate) tags: 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 expand_groups(mut self, expand_groups: bool) -> Self { - self.expand_groups = Some(expand_groups); - self - } - pub fn tags(mut self, tags: impl Into) -> Self { - self.tags = Some(tags.into()); - self - } - 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.ApiManagement/service/{}/products", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation/listSecrets" , 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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -19162,22 +27639,8 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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()); - } - if let Some(expand_groups) = &self.expand_groups { - url.query_pairs_mut().append_pair("expandGroups", &expand_groups.to_string()); - } - if let Some(tags) = &self.tags { - url.query_pairs_mut().append_pair("tags", tags); - } 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)?; @@ -19185,7 +27648,7 @@ pub mod product { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProductCollection = + let rsp_value: models::PortalSettingValidationKeyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -19203,7 +27666,101 @@ pub mod product { } } } - pub mod get { +} +pub mod private_endpoint_connection { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> list_by_service::Builder { + list_by_service::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_by_name( + &self, + resource_group_name: impl Into, + service_name: impl Into, + private_endpoint_connection_name: impl Into, + subscription_id: impl Into, + ) -> get_by_name::Builder { + get_by_name::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + private_endpoint_connection_name: impl Into, + subscription_id: impl Into, + private_endpoint_connection_request: 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(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + subscription_id: subscription_id.into(), + private_endpoint_connection_request: private_endpoint_connection_request.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + private_endpoint_connection_name: 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(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_private_link_resources( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + service_name: impl Into, + ) -> list_private_link_resources::Builder { + list_private_link_resources::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + service_name: service_name.into(), + } + } + pub fn get_private_link_resource( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + service_name: impl Into, + private_link_sub_resource_name: impl Into, + ) -> get_private_link_resource::Builder { + get_private_link_resource::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + service_name: service_name.into(), + private_link_sub_resource_name: private_link_sub_resource_name.into(), + } + } + } + pub mod list_by_service { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -19230,21 +27787,21 @@ pub mod product { #[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) product_id: String, - 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.ApiManagement/service/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/privateEndpointConnections", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &self.service_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -19264,7 +27821,7 @@ pub mod product { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProductContract = + let rsp_value: models::PrivateEndpointConnectionListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -19282,13 +27839,8 @@ pub mod product { } } } - pub mod create_or_update { + pub mod get_by_name { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ProductContract), - Ok200(models::ProductContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -19316,29 +27868,23 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) parameters: models::ProductContract, + pub(crate) private_endpoint_connection_name: String, 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> { + 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/privateEndpointConnections/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -19346,27 +27892,17 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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); - } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ProductContract = - 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::ProductContract = + 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)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -19382,8 +27918,13 @@ pub mod product { } } } - pub mod update { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201, + Ok200(models::PrivateEndpointConnection), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -19411,25 +27952,24 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) parameters: models::ProductUpdateParameters, - pub(crate) if_match: String, + pub(crate) private_endpoint_connection_name: String, pub(crate) subscription_id: String, + pub(crate) private_endpoint_connection_request: models::PrivateEndpointConnectionRequest, } 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.ApiManagement/service/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/privateEndpointConnections/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id + &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::PATCH); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -19438,18 +27978,18 @@ pub mod product { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); 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.header("If-Match", &self.if_match); + let req_body = azure_core::to_json(&self.private_endpoint_connection_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::CREATED => Ok(Response::Created201), http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ProductContract = + let rsp_value: models::PrivateEndpointConnection = 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)?; @@ -19470,6 +28010,7 @@ pub mod product { #[derive(Debug)] pub enum Response { Ok200, + Accepted202, NoContent204, } #[derive(Debug, thiserror :: Error)] @@ -19499,25 +28040,19 @@ pub mod product { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) if_match: String, + pub(crate) private_endpoint_connection_name: String, pub(crate) subscription_id: String, - pub(crate) delete_subscriptions: Option, - } - impl Builder { - pub fn delete_subscriptions(mut self, delete_subscriptions: bool) -> Self { - self.delete_subscriptions = Some(delete_subscriptions); - self - } + } + impl Builder { 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/privateEndpointConnections/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id + &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(); @@ -19529,11 +28064,6 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - req_builder = req_builder.header("If-Match", &self.if_match); - if let Some(delete_subscriptions) = &self.delete_subscriptions { - url.query_pairs_mut() - .append_pair("deleteSubscriptions", &delete_subscriptions.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)?; @@ -19541,6 +28071,7 @@ pub mod product { 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)?; @@ -19556,7 +28087,7 @@ pub mod product { } } } - pub mod get_entity_tag { + pub mod list_private_link_resources { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -19584,24 +28115,24 @@ pub mod product { pub struct Builder { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) product_id: String, pub(crate) subscription_id: String, + pub(crate) service_name: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/products/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/privateLinkResources", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &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::HEAD); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -19615,7 +28146,12 @@ pub mod product { let rsp = 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(()), + 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 = @@ -19630,7 +28166,7 @@ pub mod product { } } } - pub mod list_by_tags { + pub mod get_private_link_resource { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -19658,38 +28194,20 @@ pub mod product { 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, - pub(crate) include_not_tagged_products: Option, + pub(crate) service_name: String, + pub(crate) private_link_sub_resource_name: String, } 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 include_not_tagged_products(mut self, include_not_tagged_products: bool) -> Self { - self.include_not_tagged_products = Some(include_not_tagged_products); - self - } - 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.ApiManagement/service/{}/productsByTags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/privateLinkResources/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.private_link_sub_resource_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -19701,19 +28219,6 @@ pub mod product { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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()); - } - if let Some(include_not_tagged_products) = &self.include_not_tagged_products { - url.query_pairs_mut() - .append_pair("includeNotTaggedProducts", &include_not_tagged_products.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)?; @@ -19722,7 +28227,7 @@ pub mod product { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagResourceCollection = + let rsp_value: models::PrivateLinkResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -19741,26 +28246,41 @@ pub mod product { } } } -pub mod product_api { +pub mod product { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_product( + pub fn list_by_service( &self, resource_group_name: impl Into, service_name: impl Into, - product_id: impl Into, subscription_id: impl Into, - ) -> list_by_product::Builder { - list_by_product::Builder { + ) -> list_by_service::Builder { + list_by_service::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - product_id: product_id.into(), subscription_id: subscription_id.into(), filter: None, top: None, skip: None, + expand_groups: None, + tags: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_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(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), } } pub fn create_or_update( @@ -19768,7 +28288,7 @@ pub mod product_api { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - api_id: impl Into, + parameters: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -19776,7 +28296,27 @@ pub mod product_api { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - api_id: api_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), } } @@ -19785,7 +28325,7 @@ pub mod product_api { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - api_id: impl Into, + if_match: impl Into, subscription_id: impl Into, ) -> delete::Builder { delete::Builder { @@ -19793,138 +28333,46 @@ pub mod product_api { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - api_id: api_id.into(), + if_match: if_match.into(), subscription_id: subscription_id.into(), + delete_subscriptions: None, } } - pub fn check_entity_exists( + pub fn get_entity_tag( &self, resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - api_id: impl Into, subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - api_id: api_id.into(), subscription_id: subscription_id.into(), } } - } - pub mod list_by_product { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: 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/{}/products/{}/apis", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_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", "2021-04-01-preview"); - 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::ApiCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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 list_by_tags( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_tags::Builder { + list_by_tags::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, + include_not_tagged_products: None, } } } - pub mod create_or_update { + pub mod list_by_service { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::ApiContract), - Ok200(models::ApiContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -19952,25 +28400,46 @@ pub mod product_api { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) api_id: String, pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) expand_groups: Option, + pub(crate) tags: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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 expand_groups(mut self, expand_groups: bool) -> Self { + self.expand_groups = Some(expand_groups); + self + } + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.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/{}/products/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.api_id + &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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -19978,106 +28447,33 @@ pub mod product_api { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); + 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()); + } + if let Some(expand_groups) = &self.expand_groups { + url.query_pairs_mut().append_pair("expandGroups", &expand_groups.to_string()); + } + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ApiContract = - 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::ApiContract = - 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 = + let rsp_value: models::ProductCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) + Ok(rsp_value) } - } - }) - } - } - } - pub mod delete { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: String, - pub(crate) api_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/{}/products/{}/apis/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.api_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", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = 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 = @@ -20092,7 +28488,7 @@ pub mod product_api { } } } - pub mod check_entity_exists { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -20122,24 +28518,22 @@ pub mod product_api { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) api_id: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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/{}/products/{}/apis/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.api_id + &self.product_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -20153,98 +28547,33 @@ pub mod product_api { let 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 => { + http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ErrorResponse = + let rsp_value: models::ProductContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { - status_code, - value: rsp_value, - }) + Ok(rsp_value) } - } - }) - } - } - } -} -pub mod product_group { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - subscription_id: impl Into, - ) -> list_by_product::Builder { - list_by_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - group_id: 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(), - product_id: product_id.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - group_id: 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(), - product_id: product_id.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn check_entity_exists( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - group_id: impl Into, - subscription_id: impl Into, - ) -> check_entity_exists::Builder { - check_entity_exists::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - group_id: group_id.into(), - subscription_id: subscription_id.into(), + 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_product { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ProductContract), + Ok200(models::ProductContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -20273,28 +28602,19 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, + pub(crate) parameters: models::ProductContract, pub(crate) subscription_id: String, - pub(crate) filter: Option, - pub(crate) top: Option, - pub(crate) skip: Option, + pub(crate) if_match: 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); + 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> { + 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/{}/products/{}/groups", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -20303,7 +28623,7 @@ pub mod product_group { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -20311,26 +28631,27 @@ pub mod product_group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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()); + 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); } - let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::ProductContract = + 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::GroupCollection = + let rsp_value: models::ProductContract = 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)?; @@ -20346,13 +28667,8 @@ pub mod product_group { } } } - pub mod create_or_update { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::GroupContract), - Ok200(models::GroupContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -20381,24 +28697,24 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) group_id: String, + pub(crate) parameters: models::ProductUpdateParameters, + pub(crate) if_match: String, 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.ApiManagement/service/{}/products/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.group_id + &self.product_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); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -20406,23 +28722,19 @@ pub mod product_group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; + 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.header("If-Match", &self.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::GroupContract = - 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::GroupContract = + let rsp_value: models::ProductContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -20473,20 +28785,24 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) group_id: String, + pub(crate) if_match: String, pub(crate) subscription_id: String, + pub(crate) delete_subscriptions: Option, } impl Builder { + pub fn delete_subscriptions(mut self, delete_subscriptions: bool) -> Self { + self.delete_subscriptions = Some(delete_subscriptions); + 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/{}/products/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.group_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -20498,6 +28814,11 @@ pub mod product_group { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + if let Some(delete_subscriptions) = &self.delete_subscriptions { + url.query_pairs_mut() + .append_pair("deleteSubscriptions", &delete_subscriptions.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)?; @@ -20520,7 +28841,7 @@ pub mod product_group { } } } - pub mod check_entity_exists { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -20550,20 +28871,18 @@ pub mod product_group { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) group_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/{}/products/{}/groups/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.group_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -20581,7 +28900,7 @@ pub mod product_group { let 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(()), + 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 = @@ -20596,31 +28915,7 @@ pub mod product_group { } } } -} -pub mod product_subscriptions { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - subscription_id: impl Into, - ) -> list::Builder { - list::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - } - pub mod list { + pub mod list_by_tags { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -20649,11 +28944,11 @@ pub mod product_subscriptions { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) product_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, + pub(crate) include_not_tagged_products: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -20668,15 +28963,18 @@ pub mod product_subscriptions { self.skip = Some(skip); self } - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn include_not_tagged_products(mut self, include_not_tagged_products: bool) -> Self { + self.include_not_tagged_products = Some(include_not_tagged_products); + 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/{}/products/{}/subscriptions", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/productsByTags", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name, - &self.product_id + &self.service_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -20697,6 +28995,10 @@ pub mod product_subscriptions { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } + if let Some(include_not_tagged_products) = &self.include_not_tagged_products { + url.query_pairs_mut() + .append_pair("includeNotTaggedProducts", &include_not_tagged_products.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)?; @@ -20705,7 +29007,7 @@ pub mod product_subscriptions { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::SubscriptionCollection = + let rsp_value: models::TagResourceCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -20724,7 +29026,7 @@ pub mod product_subscriptions { } } } -pub mod product_policy { +pub mod product_api { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -20741,24 +29043,9 @@ pub mod product_policy { service_name: service_name.into(), product_id: product_id.into(), subscription_id: subscription_id.into(), - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - policy_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(), - product_id: product_id.into(), - policy_id: policy_id.into(), - subscription_id: subscription_id.into(), - format: None, + filter: None, + top: None, + skip: None, } } pub fn create_or_update( @@ -20766,8 +29053,7 @@ pub mod product_policy { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - policy_id: impl Into, - parameters: impl Into, + api_id: impl Into, subscription_id: impl Into, ) -> create_or_update::Builder { create_or_update::Builder { @@ -20775,10 +29061,8 @@ pub mod product_policy { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - policy_id: policy_id.into(), - parameters: parameters.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), - if_match: None, } } pub fn delete( @@ -20786,8 +29070,7 @@ pub mod product_policy { resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - policy_id: impl Into, - if_match: impl Into, + api_id: impl Into, subscription_id: impl Into, ) -> delete::Builder { delete::Builder { @@ -20795,109 +29078,29 @@ pub mod product_policy { resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - policy_id: policy_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, - product_id: impl Into, - policy_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(), - product_id: product_id.into(), - policy_id: policy_id.into(), + api_id: api_id.into(), subscription_id: subscription_id.into(), - } - } - } - pub mod list_by_product { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_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/{}/products/{}/policies", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_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", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match 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)?; - 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 check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), } } } - pub mod get { + pub mod list_by_product { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -20927,25 +29130,33 @@ pub mod product_policy { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) policy_id: String, pub(crate) subscription_id: String, - pub(crate) format: Option, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, } impl Builder { - pub fn format(mut self, format: impl Into) -> Self { - self.format = Some(format.into()); + 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> { + 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/{}/products/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.product_id, - &self.policy_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -20957,8 +29168,14 @@ pub mod product_policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - if let Some(format) = &self.format { - url.query_pairs_mut().append_pair("format", format); + 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()); @@ -20968,7 +29185,7 @@ pub mod product_policy { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PolicyContract = + let rsp_value: models::ApiCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -20990,8 +29207,8 @@ pub mod product_policy { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::PolicyContract), - Ok200(models::PolicyContract), + Created201(models::ApiContract), + Ok200(models::ApiContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -21021,26 +29238,20 @@ pub mod product_policy { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) policy_id: String, - pub(crate) parameters: models::PolicyContract, + pub(crate) api_id: String, 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/{}/products/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.policy_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -21052,11 +29263,7 @@ pub mod product_policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - if let Some(if_match) = &self.if_match { - req_builder = req_builder.header("If-Match", if_match); - } - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -21064,13 +29271,13 @@ pub mod product_policy { 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::PolicyContract = + let rsp_value: models::ApiContract = 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::PolicyContract = + let rsp_value: models::ApiContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -21123,21 +29330,20 @@ pub mod product_policy { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) policy_id: String, - pub(crate) if_match: String, + pub(crate) api_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/{}/products/{}/policies/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.policy_id + &self.api_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -21149,7 +29355,6 @@ pub mod product_policy { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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)?; @@ -21172,7 +29377,7 @@ pub mod product_policy { } } } - pub mod get_entity_tag { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -21198,213 +29403,93 @@ pub mod product_policy { } #[derive(Clone)] pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) service_name: String, - pub(crate) product_id: String, - pub(crate) policy_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/{}/products/{}/policies/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.policy_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", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = 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 tag { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - subscription_id: impl Into, - ) -> list_by_product::Builder { - list_by_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - subscription_id: subscription_id.into(), - filter: None, - top: None, - skip: None, - } - } - pub fn get_by_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - tag_id: impl Into, - subscription_id: impl Into, - ) -> get_by_product::Builder { - get_by_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn assign_to_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - tag_id: impl Into, - subscription_id: impl Into, - ) -> assign_to_product::Builder { - assign_to_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), - } - } - pub fn detach_from_product( - &self, - resource_group_name: impl Into, - service_name: impl Into, - product_id: impl Into, - tag_id: impl Into, - subscription_id: impl Into, - ) -> detach_from_product::Builder { - detach_from_product::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) api_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/{}/products/{}/apis/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.api_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", "2021-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::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 get_entity_state_by_product( + } +} +pub mod product_group { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_product( &self, resource_group_name: impl Into, service_name: impl Into, product_id: impl Into, - tag_id: impl Into, subscription_id: impl Into, - ) -> get_entity_state_by_product::Builder { - get_entity_state_by_product::Builder { + ) -> list_by_product::Builder { + list_by_product::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), product_id: product_id.into(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), - } - } - 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, - scope: None, - } - } - pub fn get( - &self, - resource_group_name: impl Into, - service_name: impl Into, - tag_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(), - tag_id: tag_id.into(), - subscription_id: subscription_id.into(), } } pub fn create_or_update( &self, resource_group_name: impl Into, service_name: impl Into, - tag_id: impl Into, - parameters: impl Into, + product_id: impl Into, + group_id: 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(), - tag_id: tag_id.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - if_match: None, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - service_name: impl Into, - tag_id: impl Into, - parameters: impl Into, - if_match: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - service_name: service_name.into(), - tag_id: tag_id.into(), - parameters: parameters.into(), - if_match: if_match.into(), + product_id: product_id.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -21412,31 +29497,33 @@ pub mod tag { &self, resource_group_name: impl Into, service_name: impl Into, - tag_id: impl Into, - if_match: impl Into, + product_id: impl Into, + group_id: 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(), - tag_id: tag_id.into(), - if_match: if_match.into(), + product_id: product_id.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } - pub fn get_entity_state( + pub fn check_entity_exists( &self, resource_group_name: impl Into, service_name: impl Into, - tag_id: impl Into, + product_id: impl Into, + group_id: impl Into, subscription_id: impl Into, - ) -> get_entity_state::Builder { - get_entity_state::Builder { + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), service_name: service_name.into(), - tag_id: tag_id.into(), + product_id: product_id.into(), + group_id: group_id.into(), subscription_id: subscription_id.into(), } } @@ -21489,10 +29576,10 @@ pub mod tag { self.skip = Some(skip); self } - 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.ApiManagement/service/{}/products/{}/tags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, @@ -21526,88 +29613,7 @@ pub mod tag { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagCollection = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - 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_product { - use super::models; - #[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")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] 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) product_id: String, - pub(crate) tag_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/{}/products/{}/tags/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.service_name, - &self.product_id, - &self.tag_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", "2021-04-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagContract = + let rsp_value: models::GroupCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -21625,12 +29631,12 @@ pub mod tag { } } } - pub mod assign_to_product { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::TagContract), - Ok200(models::TagContract), + Created201(models::GroupContract), + Ok200(models::GroupContract), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -21660,20 +29666,20 @@ pub mod tag { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) tag_id: String, + pub(crate) group_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/{}/products/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.tag_id + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -21693,13 +29699,13 @@ pub mod tag { 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::TagContract = + let rsp_value: models::GroupContract = 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::TagContract = + let rsp_value: models::GroupContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(Response::Ok200(rsp_value)) } @@ -21717,7 +29723,7 @@ pub mod tag { } } } - pub mod detach_from_product { + pub mod delete { use super::models; #[derive(Debug)] pub enum Response { @@ -21752,20 +29758,20 @@ pub mod tag { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) tag_id: String, + pub(crate) group_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/{}/products/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.tag_id + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -21799,7 +29805,7 @@ pub mod tag { } } } - pub mod get_entity_state_by_product { + pub mod check_entity_exists { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -21829,20 +29835,20 @@ pub mod tag { pub(crate) resource_group_name: String, pub(crate) service_name: String, pub(crate) product_id: String, - pub(crate) tag_id: String, + pub(crate) group_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/{}/products/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, &self.product_id, - &self.tag_id + &self.group_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -21860,7 +29866,7 @@ pub mod tag { let rsp = 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(()), + 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::ErrorResponse = @@ -21875,7 +29881,31 @@ pub mod tag { } } } - pub mod list_by_service { +} +pub mod product_subscriptions { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -21904,11 +29934,11 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, + pub(crate) product_id: String, pub(crate) subscription_id: String, pub(crate) filter: Option, pub(crate) top: Option, pub(crate) skip: Option, - pub(crate) scope: Option, } impl Builder { pub fn filter(mut self, filter: impl Into) -> Self { @@ -21923,18 +29953,15 @@ pub mod tag { self.skip = Some(skip); self } - pub fn scope(mut self, scope: impl Into) -> Self { - self.scope = Some(scope.into()); - self - } - 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.ApiManagement/service/{}/tags", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/subscriptions", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.service_name + &self.service_name, + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -21955,9 +29982,6 @@ pub mod tag { if let Some(skip) = &self.skip { url.query_pairs_mut().append_pair("$skip", &skip.to_string()); } - if let Some(scope) = &self.scope { - url.query_pairs_mut().append_pair("scope", scope); - } let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -21966,7 +29990,7 @@ pub mod tag { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagCollection = + let rsp_value: models::SubscriptionCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -21984,7 +30008,102 @@ pub mod tag { } } } - pub mod get { +} +pub mod product_policy { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list_by_product::Builder { + list_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + format: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_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, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_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, + product_id: impl Into, + policy_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(), + product_id: product_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_product { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -22013,19 +30132,19 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, + pub(crate) product_id: String, 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.ApiManagement/service/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -22045,7 +30164,7 @@ pub mod tag { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::TagContract = + let rsp_value: models::PolicyCollection = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -22063,13 +30182,8 @@ pub mod tag { } } } - pub mod create_or_update { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Created201(models::TagContract), - Ok200(models::TagContract), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -22097,29 +30211,30 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, - pub(crate) parameters: models::TagCreateUpdateParameters, + pub(crate) product_id: String, + pub(crate) policy_id: String, pub(crate) subscription_id: String, - pub(crate) if_match: Option, + pub(crate) format: Option, } impl Builder { - pub fn if_match(mut self, if_match: impl Into) -> Self { - self.if_match = Some(if_match.into()); + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.into()); self } - 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.ApiManagement/service/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -22127,27 +30242,20 @@ pub mod tag { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); - 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); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); } + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let 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::TagContract = - 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::TagContract = + let rsp_value: models::PolicyContract = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) + Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -22163,8 +30271,13 @@ pub mod tag { } } } - pub mod update { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -22192,25 +30305,31 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, - pub(crate) parameters: models::TagCreateUpdateParameters, - pub(crate) if_match: String, + pub(crate) product_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, pub(crate) subscription_id: String, + pub(crate) if_match: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_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); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -22218,19 +30337,27 @@ pub mod tag { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-04-01-preview"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } 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.header("If-Match", &self.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::PolicyContract = + 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::TagContract = + let rsp_value: models::PolicyContract = 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)?; @@ -22280,7 +30407,8 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, + pub(crate) product_id: String, + pub(crate) policy_id: String, pub(crate) if_match: String, pub(crate) subscription_id: String, } @@ -22288,12 +30416,13 @@ pub mod tag { 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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -22328,7 +30457,7 @@ pub mod tag { } } } - pub mod get_entity_state { + pub mod get_entity_tag { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -22357,19 +30486,21 @@ pub mod tag { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) service_name: String, - pub(crate) tag_id: String, + pub(crate) product_id: String, + pub(crate) policy_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/{}/tags/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.service_name, - &self.tag_id + &self.product_id, + &self.policy_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); diff --git a/services/mgmt/authorization/README.md b/services/mgmt/authorization/README.md index f794e49409..39f5326529 100644 --- a/services/mgmt/authorization/README.md +++ b/services/mgmt/authorization/README.md @@ -16,18 +16,18 @@ The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/servi - `package-2021-01-01-preview-only` has 13 operations from 1 API versions: `2021-01-01-preview`. Use crate feature `package-2021-01-01-preview-only` to enable. The operations will be in the `package_2021_01_01_preview_only` module. - `package-2020-10-01-preview-only` has 37 operations from 1 API versions: `2020-10-01-preview`. Use crate feature `package-2020-10-01-preview-only` to enable. The operations will be in the `package_2020_10_01_preview_only` module. - `profile-hybrid-2020-09-01` has 20 operations from 1 API versions: `2015-07-01`. Use crate feature `profile-hybrid-2020-09-01` to enable. The operations will be in the `profile_hybrid_2020_09_01` module. -- `package-2020-08-01-preview` has 24 operations from 6 API versions: `2015-06-01`, `2015-07-01`, `2018-01-01-preview`, `2018-07-01-preview`, `2019-08-01-preview`, `2020-08-01-preview`. Use crate feature `package-2020-08-01-preview` to enable. The operations will be in the `package_2020_08_01_preview` module. -- `package-2020-04-01-preview` has 22 operations from 6 API versions: `2015-06-01`, `2015-07-01`, `2018-01-01-preview`, `2018-07-01-preview`, `2019-08-01-preview`, `2020-04-01-preview`. Use crate feature `package-2020-04-01-preview` to enable. The operations will be in the `package_2020_04_01_preview` module. +- `package-2020-08-01-preview` has 30 operations from 6 API versions: `2015-06-01`, `2015-07-01`, `2018-01-01-preview`, `2018-07-01-preview`, `2019-08-01-preview`, `2020-08-01-preview`. Use crate feature `package-2020-08-01-preview` to enable. The operations will be in the `package_2020_08_01_preview` module. +- `package-2020-04-01-preview` has 28 operations from 6 API versions: `2015-06-01`, `2015-07-01`, `2018-01-01-preview`, `2018-07-01-preview`, `2019-08-01-preview`, `2020-04-01-preview`. Use crate feature `package-2020-04-01-preview` to enable. The operations will be in the `package_2020_04_01_preview` module. - `package-2020-04-01-preview-only` has 10 operations from 1 API versions: `2020-04-01-preview`. Use crate feature `package-2020-04-01-preview-only` to enable. The operations will be in the `package_2020_04_01_preview_only` module. -- `package-2020-03-01-preview` has 22 operations from 6 API versions: `2015-06-01`, `2015-07-01`, `2018-01-01-preview`, `2018-07-01-preview`, `2019-08-01-preview`, `2020-03-01-preview`. Use crate feature `package-2020-03-01-preview` to enable. The operations will be in the `package_2020_03_01_preview` module. +- `package-2020-03-01-preview` has 28 operations from 6 API versions: `2015-06-01`, `2015-07-01`, `2018-01-01-preview`, `2018-07-01-preview`, `2019-08-01-preview`, `2020-03-01-preview`. Use crate feature `package-2020-03-01-preview` to enable. The operations will be in the `package_2020_03_01_preview` module. - `package-2019-08-01-preview-only` has 1 operations from 1 API versions: `2019-08-01-preview`. Use crate feature `package-2019-08-01-preview-only` to enable. The operations will be in the `package_2019_08_01_preview_only` module. - `profile-hybrid-2019-03-01` has 20 operations from 1 API versions: `2015-07-01`. Use crate feature `profile-hybrid-2019-03-01` to enable. The operations will be in the `profile_hybrid_2019_03_01` module. -- `package-2018-09-01-preview` has 21 operations from 5 API versions: `2015-06-01`, `2015-07-01`, `2018-01-01-preview`, `2018-07-01-preview`, `2018-09-01-preview`. Use crate feature `package-2018-09-01-preview` to enable. The operations will be in the `package_2018_09_01_preview` module. +- `package-2018-09-01-preview` has 27 operations from 5 API versions: `2015-06-01`, `2015-07-01`, `2018-01-01-preview`, `2018-07-01-preview`, `2018-09-01-preview`. Use crate feature `package-2018-09-01-preview` to enable. The operations will be in the `package_2018_09_01_preview` module. - `package-2018-09-01-preview-only` has 10 operations from 1 API versions: `2018-09-01-preview`. Use crate feature `package-2018-09-01-preview-only` to enable. The operations will be in the `package_2018_09_01_preview_only` module. -- `package-2018-07-01-preview` has 21 operations from 4 API versions: `2015-06-01`, `2015-07-01`, `2018-01-01-preview`, `2018-07-01-preview`. Use crate feature `package-2018-07-01-preview` to enable. The operations will be in the `package_2018_07_01_preview` module. +- `package-2018-07-01-preview` has 27 operations from 4 API versions: `2015-06-01`, `2015-07-01`, `2018-01-01-preview`, `2018-07-01-preview`. Use crate feature `package-2018-07-01-preview` to enable. The operations will be in the `package_2018_07_01_preview` module. - `package-2018-07-01-preview-only` has 6 operations from 1 API versions: `2018-07-01-preview`. Use crate feature `package-2018-07-01-preview-only` to enable. The operations will be in the `package_2018_07_01_preview_only` module. -- `package-2018-01-01-preview` has 15 operations from 3 API versions: `2015-06-01`, `2015-07-01`, `2018-01-01-preview`. Use crate feature `package-2018-01-01-preview` to enable. The operations will be in the `package_2018_01_01_preview` module. -- `package-2018-01-01-preview-only` has 13 operations from 1 API versions: `2018-01-01-preview`. Use crate feature `package-2018-01-01-preview-only` to enable. The operations will be in the `package_2018_01_01_preview_only` module. +- `package-2018-01-01-preview` has 21 operations from 3 API versions: `2015-06-01`, `2015-07-01`, `2018-01-01-preview`. Use crate feature `package-2018-01-01-preview` to enable. The operations will be in the `package_2018_01_01_preview` module. +- `package-2018-01-01-preview-only` has 19 operations from 1 API versions: `2018-01-01-preview`. Use crate feature `package-2018-01-01-preview-only` to enable. The operations will be in the `package_2018_01_01_preview_only` module. - `package-2017-10-01-preview` has 21 operations from 3 API versions: `2015-06-01`, `2015-07-01`, `2017-10-01-preview`. Use crate feature `package-2017-10-01-preview` to enable. The operations will be in the `package_2017_10_01_preview` module. - `package-2017-10-01-preview-only` has 10 operations from 1 API versions: `2017-10-01-preview`. Use crate feature `package-2017-10-01-preview-only` to enable. The operations will be in the `package_2017_10_01_preview_only` module. - `package-2015-07-01` has 21 operations from 1 API versions: `2015-07-01`. Use crate feature `package-2015-07-01` to enable. The operations will be in the `package_2015_07_01` module. diff --git a/services/mgmt/authorization/src/package_2018_01_01_preview/operations.rs b/services/mgmt/authorization/src/package_2018_01_01_preview/operations.rs index 064271eaab..184eaba469 100644 --- a/services/mgmt/authorization/src/package_2018_01_01_preview/operations.rs +++ b/services/mgmt/authorization/src/package_2018_01_01_preview/operations.rs @@ -80,6 +80,9 @@ impl Client { pub fn global_administrator(&self) -> global_administrator::Client { global_administrator::Client(self.clone()) } + pub fn permissions(&self) -> permissions::Client { + permissions::Client(self.clone()) + } pub fn provider_operations_metadata(&self) -> provider_operations_metadata::Client { provider_operations_metadata::Client(self.clone()) } @@ -124,6 +127,18 @@ pub enum Error { RoleAssignments_ListForScope(#[from] role_assignments::list_for_scope::Error), #[error(transparent)] RoleDefinitions_GetById(#[from] role_definitions::get_by_id::Error), + #[error(transparent)] + Permissions_ListForResourceGroup(#[from] permissions::list_for_resource_group::Error), + #[error(transparent)] + Permissions_ListForResource(#[from] permissions::list_for_resource::Error), + #[error(transparent)] + RoleDefinitions_Get(#[from] role_definitions::get::Error), + #[error(transparent)] + RoleDefinitions_CreateOrUpdate(#[from] role_definitions::create_or_update::Error), + #[error(transparent)] + RoleDefinitions_Delete(#[from] role_definitions::delete::Error), + #[error(transparent)] + RoleDefinitions_List(#[from] role_definitions::list::Error), } pub mod classic_administrators { use super::models; @@ -1361,6 +1376,40 @@ pub mod role_definitions { role_id: role_id.into(), } } + pub fn get(&self, scope: impl Into, role_definition_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + scope: scope.into(), + role_definition_id: role_definition_id.into(), + } + } + pub fn create_or_update( + &self, + scope: impl Into, + role_definition_id: impl Into, + role_definition: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + scope: scope.into(), + role_definition_id: role_definition_id.into(), + role_definition: role_definition.into(), + } + } + pub fn delete(&self, scope: impl Into, role_definition_id: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + scope: scope.into(), + role_definition_id: role_definition_id.into(), + } + } + pub fn list(&self, scope: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + scope: scope.into(), + filter: None, + } + } } pub mod get_by_id { use super::models; @@ -1431,4 +1480,512 @@ pub mod role_definitions { } } } + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) role_definition_id: 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.Authorization/roleDefinitions/{}", + self.client.endpoint(), + &self.scope, + &self.role_definition_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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RoleDefinition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) role_definition_id: String, + pub(crate) role_definition: models::RoleDefinition, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.Authorization/roleDefinitions/{}", + self.client.endpoint(), + &self.scope, + &self.role_definition_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", "2018-01-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.role_definition).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::RoleDefinition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Ok200(models::RoleDefinition), + 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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) role_definition_id: 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.Authorization/roleDefinitions/{}", + self.client.endpoint(), + &self.scope, + &self.role_definition_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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RoleDefinition = + 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::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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: 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!( + "{}/{}/providers/Microsoft.Authorization/roleDefinitions", + self.client.endpoint(), + &self.scope + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2018-01-01-preview"); + 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::RoleDefinitionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 permissions { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_for_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_for_resource_group::Builder { + list_for_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_for_resource( + &self, + resource_group_name: impl Into, + resource_provider_namespace: impl Into, + parent_resource_path: impl Into, + resource_type: impl Into, + resource_name: impl Into, + subscription_id: impl Into, + ) -> list_for_resource::Builder { + list_for_resource::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + resource_provider_namespace: resource_provider_namespace.into(), + parent_resource_path: parent_resource_path.into(), + resource_type: resource_type.into(), + resource_name: resource_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_for_resource_group { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.Authorization/permissions", + 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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PermissionGetResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_for_resource { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) resource_provider_namespace: String, + pub(crate) parent_resource_path: String, + pub(crate) resource_type: String, + pub(crate) resource_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/{}/{}/{}/{}/providers/Microsoft.Authorization/permissions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_provider_namespace, + &self.parent_resource_path, + &self.resource_type, + &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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PermissionGetResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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/authorization/src/package_2018_01_01_preview_only/operations.rs b/services/mgmt/authorization/src/package_2018_01_01_preview_only/operations.rs index 65baa168d3..39a4d7b7cb 100644 --- a/services/mgmt/authorization/src/package_2018_01_01_preview_only/operations.rs +++ b/services/mgmt/authorization/src/package_2018_01_01_preview_only/operations.rs @@ -74,6 +74,9 @@ impl Client { pipeline, } } + pub fn permissions(&self) -> permissions::Client { + permissions::Client(self.clone()) + } pub fn provider_operations_metadata(&self) -> provider_operations_metadata::Client { provider_operations_metadata::Client(self.clone()) } @@ -114,6 +117,18 @@ pub enum Error { RoleAssignments_ListForScope(#[from] role_assignments::list_for_scope::Error), #[error(transparent)] RoleDefinitions_GetById(#[from] role_definitions::get_by_id::Error), + #[error(transparent)] + Permissions_ListForResourceGroup(#[from] permissions::list_for_resource_group::Error), + #[error(transparent)] + Permissions_ListForResource(#[from] permissions::list_for_resource::Error), + #[error(transparent)] + RoleDefinitions_Get(#[from] role_definitions::get::Error), + #[error(transparent)] + RoleDefinitions_CreateOrUpdate(#[from] role_definitions::create_or_update::Error), + #[error(transparent)] + RoleDefinitions_Delete(#[from] role_definitions::delete::Error), + #[error(transparent)] + RoleDefinitions_List(#[from] role_definitions::list::Error), } pub mod provider_operations_metadata { use super::models; @@ -1191,6 +1206,40 @@ pub mod role_definitions { role_id: role_id.into(), } } + pub fn get(&self, scope: impl Into, role_definition_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + scope: scope.into(), + role_definition_id: role_definition_id.into(), + } + } + pub fn create_or_update( + &self, + scope: impl Into, + role_definition_id: impl Into, + role_definition: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + scope: scope.into(), + role_definition_id: role_definition_id.into(), + role_definition: role_definition.into(), + } + } + pub fn delete(&self, scope: impl Into, role_definition_id: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + scope: scope.into(), + role_definition_id: role_definition_id.into(), + } + } + pub fn list(&self, scope: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + scope: scope.into(), + filter: None, + } + } } pub mod get_by_id { use super::models; @@ -1261,4 +1310,512 @@ pub mod role_definitions { } } } + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) role_definition_id: 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.Authorization/roleDefinitions/{}", + self.client.endpoint(), + &self.scope, + &self.role_definition_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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RoleDefinition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) role_definition_id: String, + pub(crate) role_definition: models::RoleDefinition, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.Authorization/roleDefinitions/{}", + self.client.endpoint(), + &self.scope, + &self.role_definition_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", "2018-01-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.role_definition).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::RoleDefinition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Ok200(models::RoleDefinition), + 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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) role_definition_id: 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.Authorization/roleDefinitions/{}", + self.client.endpoint(), + &self.scope, + &self.role_definition_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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RoleDefinition = + 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::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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: 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!( + "{}/{}/providers/Microsoft.Authorization/roleDefinitions", + self.client.endpoint(), + &self.scope + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2018-01-01-preview"); + 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::RoleDefinitionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 permissions { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_for_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_for_resource_group::Builder { + list_for_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_for_resource( + &self, + resource_group_name: impl Into, + resource_provider_namespace: impl Into, + parent_resource_path: impl Into, + resource_type: impl Into, + resource_name: impl Into, + subscription_id: impl Into, + ) -> list_for_resource::Builder { + list_for_resource::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + resource_provider_namespace: resource_provider_namespace.into(), + parent_resource_path: parent_resource_path.into(), + resource_type: resource_type.into(), + resource_name: resource_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_for_resource_group { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.Authorization/permissions", + 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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PermissionGetResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_for_resource { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) resource_provider_namespace: String, + pub(crate) parent_resource_path: String, + pub(crate) resource_type: String, + pub(crate) resource_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/{}/{}/{}/{}/providers/Microsoft.Authorization/permissions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_provider_namespace, + &self.parent_resource_path, + &self.resource_type, + &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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PermissionGetResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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/authorization/src/package_2018_07_01_preview/operations.rs b/services/mgmt/authorization/src/package_2018_07_01_preview/operations.rs index f12be5266e..b817cd48ae 100644 --- a/services/mgmt/authorization/src/package_2018_07_01_preview/operations.rs +++ b/services/mgmt/authorization/src/package_2018_07_01_preview/operations.rs @@ -83,6 +83,9 @@ impl Client { pub fn global_administrator(&self) -> global_administrator::Client { global_administrator::Client(self.clone()) } + pub fn permissions(&self) -> permissions::Client { + permissions::Client(self.clone()) + } pub fn provider_operations_metadata(&self) -> provider_operations_metadata::Client { provider_operations_metadata::Client(self.clone()) } @@ -128,6 +131,18 @@ pub enum Error { #[error(transparent)] RoleDefinitions_GetById(#[from] role_definitions::get_by_id::Error), #[error(transparent)] + Permissions_ListForResourceGroup(#[from] permissions::list_for_resource_group::Error), + #[error(transparent)] + Permissions_ListForResource(#[from] permissions::list_for_resource::Error), + #[error(transparent)] + RoleDefinitions_Get(#[from] role_definitions::get::Error), + #[error(transparent)] + RoleDefinitions_CreateOrUpdate(#[from] role_definitions::create_or_update::Error), + #[error(transparent)] + RoleDefinitions_Delete(#[from] role_definitions::delete::Error), + #[error(transparent)] + RoleDefinitions_List(#[from] role_definitions::list::Error), + #[error(transparent)] DenyAssignments_ListForResource(#[from] deny_assignments::list_for_resource::Error), #[error(transparent)] DenyAssignments_ListForResourceGroup(#[from] deny_assignments::list_for_resource_group::Error), @@ -1376,6 +1391,40 @@ pub mod role_definitions { role_id: role_id.into(), } } + pub fn get(&self, scope: impl Into, role_definition_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + scope: scope.into(), + role_definition_id: role_definition_id.into(), + } + } + pub fn create_or_update( + &self, + scope: impl Into, + role_definition_id: impl Into, + role_definition: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + scope: scope.into(), + role_definition_id: role_definition_id.into(), + role_definition: role_definition.into(), + } + } + pub fn delete(&self, scope: impl Into, role_definition_id: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + scope: scope.into(), + role_definition_id: role_definition_id.into(), + } + } + pub fn list(&self, scope: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + scope: scope.into(), + filter: None, + } + } } pub mod get_by_id { use super::models; @@ -1446,6 +1495,514 @@ pub mod role_definitions { } } } + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) role_definition_id: 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.Authorization/roleDefinitions/{}", + self.client.endpoint(), + &self.scope, + &self.role_definition_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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RoleDefinition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) role_definition_id: String, + pub(crate) role_definition: models::RoleDefinition, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.Authorization/roleDefinitions/{}", + self.client.endpoint(), + &self.scope, + &self.role_definition_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", "2018-01-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.role_definition).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::RoleDefinition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Ok200(models::RoleDefinition), + 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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) role_definition_id: 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.Authorization/roleDefinitions/{}", + self.client.endpoint(), + &self.scope, + &self.role_definition_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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RoleDefinition = + 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::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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: 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!( + "{}/{}/providers/Microsoft.Authorization/roleDefinitions", + self.client.endpoint(), + &self.scope + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2018-01-01-preview"); + 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::RoleDefinitionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 permissions { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_for_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_for_resource_group::Builder { + list_for_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_for_resource( + &self, + resource_group_name: impl Into, + resource_provider_namespace: impl Into, + parent_resource_path: impl Into, + resource_type: impl Into, + resource_name: impl Into, + subscription_id: impl Into, + ) -> list_for_resource::Builder { + list_for_resource::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + resource_provider_namespace: resource_provider_namespace.into(), + parent_resource_path: parent_resource_path.into(), + resource_type: resource_type.into(), + resource_name: resource_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_for_resource_group { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.Authorization/permissions", + 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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PermissionGetResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_for_resource { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) resource_provider_namespace: String, + pub(crate) parent_resource_path: String, + pub(crate) resource_type: String, + pub(crate) resource_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/{}/{}/{}/{}/providers/Microsoft.Authorization/permissions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_provider_namespace, + &self.parent_resource_path, + &self.resource_type, + &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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PermissionGetResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 deny_assignments { use super::models; diff --git a/services/mgmt/authorization/src/package_2018_09_01_preview/operations.rs b/services/mgmt/authorization/src/package_2018_09_01_preview/operations.rs index de053a43c7..fb027a2c68 100644 --- a/services/mgmt/authorization/src/package_2018_09_01_preview/operations.rs +++ b/services/mgmt/authorization/src/package_2018_09_01_preview/operations.rs @@ -83,6 +83,9 @@ impl Client { pub fn global_administrator(&self) -> global_administrator::Client { global_administrator::Client(self.clone()) } + pub fn permissions(&self) -> permissions::Client { + permissions::Client(self.clone()) + } pub fn provider_operations_metadata(&self) -> provider_operations_metadata::Client { provider_operations_metadata::Client(self.clone()) } @@ -128,6 +131,18 @@ pub enum Error { #[error(transparent)] RoleDefinitions_GetById(#[from] role_definitions::get_by_id::Error), #[error(transparent)] + Permissions_ListForResourceGroup(#[from] permissions::list_for_resource_group::Error), + #[error(transparent)] + Permissions_ListForResource(#[from] permissions::list_for_resource::Error), + #[error(transparent)] + RoleDefinitions_Get(#[from] role_definitions::get::Error), + #[error(transparent)] + RoleDefinitions_CreateOrUpdate(#[from] role_definitions::create_or_update::Error), + #[error(transparent)] + RoleDefinitions_Delete(#[from] role_definitions::delete::Error), + #[error(transparent)] + RoleDefinitions_List(#[from] role_definitions::list::Error), + #[error(transparent)] DenyAssignments_ListForResource(#[from] deny_assignments::list_for_resource::Error), #[error(transparent)] DenyAssignments_ListForResourceGroup(#[from] deny_assignments::list_for_resource_group::Error), @@ -1376,6 +1391,40 @@ pub mod role_definitions { role_id: role_id.into(), } } + pub fn get(&self, scope: impl Into, role_definition_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + scope: scope.into(), + role_definition_id: role_definition_id.into(), + } + } + pub fn create_or_update( + &self, + scope: impl Into, + role_definition_id: impl Into, + role_definition: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + scope: scope.into(), + role_definition_id: role_definition_id.into(), + role_definition: role_definition.into(), + } + } + pub fn delete(&self, scope: impl Into, role_definition_id: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + scope: scope.into(), + role_definition_id: role_definition_id.into(), + } + } + pub fn list(&self, scope: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + scope: scope.into(), + filter: None, + } + } } pub mod get_by_id { use super::models; @@ -1446,6 +1495,514 @@ pub mod role_definitions { } } } + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) role_definition_id: 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.Authorization/roleDefinitions/{}", + self.client.endpoint(), + &self.scope, + &self.role_definition_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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RoleDefinition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) role_definition_id: String, + pub(crate) role_definition: models::RoleDefinition, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.Authorization/roleDefinitions/{}", + self.client.endpoint(), + &self.scope, + &self.role_definition_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", "2018-01-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.role_definition).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::RoleDefinition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Ok200(models::RoleDefinition), + 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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) role_definition_id: 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.Authorization/roleDefinitions/{}", + self.client.endpoint(), + &self.scope, + &self.role_definition_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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RoleDefinition = + 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::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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: 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!( + "{}/{}/providers/Microsoft.Authorization/roleDefinitions", + self.client.endpoint(), + &self.scope + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2018-01-01-preview"); + 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::RoleDefinitionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 permissions { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_for_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_for_resource_group::Builder { + list_for_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_for_resource( + &self, + resource_group_name: impl Into, + resource_provider_namespace: impl Into, + parent_resource_path: impl Into, + resource_type: impl Into, + resource_name: impl Into, + subscription_id: impl Into, + ) -> list_for_resource::Builder { + list_for_resource::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + resource_provider_namespace: resource_provider_namespace.into(), + parent_resource_path: parent_resource_path.into(), + resource_type: resource_type.into(), + resource_name: resource_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_for_resource_group { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.Authorization/permissions", + 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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PermissionGetResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_for_resource { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) resource_provider_namespace: String, + pub(crate) parent_resource_path: String, + pub(crate) resource_type: String, + pub(crate) resource_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/{}/{}/{}/{}/providers/Microsoft.Authorization/permissions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_provider_namespace, + &self.parent_resource_path, + &self.resource_type, + &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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PermissionGetResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 deny_assignments { use super::models; diff --git a/services/mgmt/authorization/src/package_2020_03_01_preview/operations.rs b/services/mgmt/authorization/src/package_2020_03_01_preview/operations.rs index 70f6391a0e..6ede7197f5 100644 --- a/services/mgmt/authorization/src/package_2020_03_01_preview/operations.rs +++ b/services/mgmt/authorization/src/package_2020_03_01_preview/operations.rs @@ -83,6 +83,9 @@ impl Client { pub fn global_administrator(&self) -> global_administrator::Client { global_administrator::Client(self.clone()) } + pub fn permissions(&self) -> permissions::Client { + permissions::Client(self.clone()) + } pub fn provider_operations_metadata(&self) -> provider_operations_metadata::Client { provider_operations_metadata::Client(self.clone()) } @@ -111,6 +114,18 @@ pub enum Error { #[error(transparent)] RoleDefinitions_GetById(#[from] role_definitions::get_by_id::Error), #[error(transparent)] + Permissions_ListForResourceGroup(#[from] permissions::list_for_resource_group::Error), + #[error(transparent)] + Permissions_ListForResource(#[from] permissions::list_for_resource::Error), + #[error(transparent)] + RoleDefinitions_Get(#[from] role_definitions::get::Error), + #[error(transparent)] + RoleDefinitions_CreateOrUpdate(#[from] role_definitions::create_or_update::Error), + #[error(transparent)] + RoleDefinitions_Delete(#[from] role_definitions::delete::Error), + #[error(transparent)] + RoleDefinitions_List(#[from] role_definitions::list::Error), + #[error(transparent)] DenyAssignments_ListForResource(#[from] deny_assignments::list_for_resource::Error), #[error(transparent)] DenyAssignments_ListForResourceGroup(#[from] deny_assignments::list_for_resource_group::Error), @@ -495,6 +510,40 @@ pub mod role_definitions { role_id: role_id.into(), } } + pub fn get(&self, scope: impl Into, role_definition_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + scope: scope.into(), + role_definition_id: role_definition_id.into(), + } + } + pub fn create_or_update( + &self, + scope: impl Into, + role_definition_id: impl Into, + role_definition: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + scope: scope.into(), + role_definition_id: role_definition_id.into(), + role_definition: role_definition.into(), + } + } + pub fn delete(&self, scope: impl Into, role_definition_id: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + scope: scope.into(), + role_definition_id: role_definition_id.into(), + } + } + pub fn list(&self, scope: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + scope: scope.into(), + filter: None, + } + } } pub mod get_by_id { use super::models; @@ -565,6 +614,514 @@ pub mod role_definitions { } } } + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) role_definition_id: 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.Authorization/roleDefinitions/{}", + self.client.endpoint(), + &self.scope, + &self.role_definition_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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RoleDefinition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) role_definition_id: String, + pub(crate) role_definition: models::RoleDefinition, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.Authorization/roleDefinitions/{}", + self.client.endpoint(), + &self.scope, + &self.role_definition_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", "2018-01-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.role_definition).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::RoleDefinition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Ok200(models::RoleDefinition), + 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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) role_definition_id: 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.Authorization/roleDefinitions/{}", + self.client.endpoint(), + &self.scope, + &self.role_definition_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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RoleDefinition = + 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::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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: 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!( + "{}/{}/providers/Microsoft.Authorization/roleDefinitions", + self.client.endpoint(), + &self.scope + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2018-01-01-preview"); + 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::RoleDefinitionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 permissions { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_for_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_for_resource_group::Builder { + list_for_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_for_resource( + &self, + resource_group_name: impl Into, + resource_provider_namespace: impl Into, + parent_resource_path: impl Into, + resource_type: impl Into, + resource_name: impl Into, + subscription_id: impl Into, + ) -> list_for_resource::Builder { + list_for_resource::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + resource_provider_namespace: resource_provider_namespace.into(), + parent_resource_path: parent_resource_path.into(), + resource_type: resource_type.into(), + resource_name: resource_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_for_resource_group { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.Authorization/permissions", + 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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PermissionGetResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_for_resource { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) resource_provider_namespace: String, + pub(crate) parent_resource_path: String, + pub(crate) resource_type: String, + pub(crate) resource_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/{}/{}/{}/{}/providers/Microsoft.Authorization/permissions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_provider_namespace, + &self.parent_resource_path, + &self.resource_type, + &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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PermissionGetResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 deny_assignments { use super::models; diff --git a/services/mgmt/authorization/src/package_2020_04_01_preview/operations.rs b/services/mgmt/authorization/src/package_2020_04_01_preview/operations.rs index 661aa3e038..4f4dcc7614 100644 --- a/services/mgmt/authorization/src/package_2020_04_01_preview/operations.rs +++ b/services/mgmt/authorization/src/package_2020_04_01_preview/operations.rs @@ -83,6 +83,9 @@ impl Client { pub fn global_administrator(&self) -> global_administrator::Client { global_administrator::Client(self.clone()) } + pub fn permissions(&self) -> permissions::Client { + permissions::Client(self.clone()) + } pub fn provider_operations_metadata(&self) -> provider_operations_metadata::Client { provider_operations_metadata::Client(self.clone()) } @@ -111,6 +114,18 @@ pub enum Error { #[error(transparent)] RoleDefinitions_GetById(#[from] role_definitions::get_by_id::Error), #[error(transparent)] + Permissions_ListForResourceGroup(#[from] permissions::list_for_resource_group::Error), + #[error(transparent)] + Permissions_ListForResource(#[from] permissions::list_for_resource::Error), + #[error(transparent)] + RoleDefinitions_Get(#[from] role_definitions::get::Error), + #[error(transparent)] + RoleDefinitions_CreateOrUpdate(#[from] role_definitions::create_or_update::Error), + #[error(transparent)] + RoleDefinitions_Delete(#[from] role_definitions::delete::Error), + #[error(transparent)] + RoleDefinitions_List(#[from] role_definitions::list::Error), + #[error(transparent)] DenyAssignments_ListForResource(#[from] deny_assignments::list_for_resource::Error), #[error(transparent)] DenyAssignments_ListForResourceGroup(#[from] deny_assignments::list_for_resource_group::Error), @@ -495,6 +510,40 @@ pub mod role_definitions { role_id: role_id.into(), } } + pub fn get(&self, scope: impl Into, role_definition_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + scope: scope.into(), + role_definition_id: role_definition_id.into(), + } + } + pub fn create_or_update( + &self, + scope: impl Into, + role_definition_id: impl Into, + role_definition: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + scope: scope.into(), + role_definition_id: role_definition_id.into(), + role_definition: role_definition.into(), + } + } + pub fn delete(&self, scope: impl Into, role_definition_id: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + scope: scope.into(), + role_definition_id: role_definition_id.into(), + } + } + pub fn list(&self, scope: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + scope: scope.into(), + filter: None, + } + } } pub mod get_by_id { use super::models; @@ -565,6 +614,514 @@ pub mod role_definitions { } } } + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) role_definition_id: 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.Authorization/roleDefinitions/{}", + self.client.endpoint(), + &self.scope, + &self.role_definition_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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RoleDefinition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) role_definition_id: String, + pub(crate) role_definition: models::RoleDefinition, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.Authorization/roleDefinitions/{}", + self.client.endpoint(), + &self.scope, + &self.role_definition_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", "2018-01-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.role_definition).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::RoleDefinition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Ok200(models::RoleDefinition), + 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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) role_definition_id: 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.Authorization/roleDefinitions/{}", + self.client.endpoint(), + &self.scope, + &self.role_definition_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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RoleDefinition = + 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::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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: 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!( + "{}/{}/providers/Microsoft.Authorization/roleDefinitions", + self.client.endpoint(), + &self.scope + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2018-01-01-preview"); + 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::RoleDefinitionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 permissions { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_for_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_for_resource_group::Builder { + list_for_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_for_resource( + &self, + resource_group_name: impl Into, + resource_provider_namespace: impl Into, + parent_resource_path: impl Into, + resource_type: impl Into, + resource_name: impl Into, + subscription_id: impl Into, + ) -> list_for_resource::Builder { + list_for_resource::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + resource_provider_namespace: resource_provider_namespace.into(), + parent_resource_path: parent_resource_path.into(), + resource_type: resource_type.into(), + resource_name: resource_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_for_resource_group { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.Authorization/permissions", + 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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PermissionGetResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_for_resource { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) resource_provider_namespace: String, + pub(crate) parent_resource_path: String, + pub(crate) resource_type: String, + pub(crate) resource_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/{}/{}/{}/{}/providers/Microsoft.Authorization/permissions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_provider_namespace, + &self.parent_resource_path, + &self.resource_type, + &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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PermissionGetResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 deny_assignments { use super::models; diff --git a/services/mgmt/authorization/src/package_2020_08_01_preview/operations.rs b/services/mgmt/authorization/src/package_2020_08_01_preview/operations.rs index 470f20f5bd..0bd0999a79 100644 --- a/services/mgmt/authorization/src/package_2020_08_01_preview/operations.rs +++ b/services/mgmt/authorization/src/package_2020_08_01_preview/operations.rs @@ -83,6 +83,9 @@ impl Client { pub fn global_administrator(&self) -> global_administrator::Client { global_administrator::Client(self.clone()) } + pub fn permissions(&self) -> permissions::Client { + permissions::Client(self.clone()) + } pub fn provider_operations_metadata(&self) -> provider_operations_metadata::Client { provider_operations_metadata::Client(self.clone()) } @@ -111,6 +114,18 @@ pub enum Error { #[error(transparent)] RoleDefinitions_GetById(#[from] role_definitions::get_by_id::Error), #[error(transparent)] + Permissions_ListForResourceGroup(#[from] permissions::list_for_resource_group::Error), + #[error(transparent)] + Permissions_ListForResource(#[from] permissions::list_for_resource::Error), + #[error(transparent)] + RoleDefinitions_Get(#[from] role_definitions::get::Error), + #[error(transparent)] + RoleDefinitions_CreateOrUpdate(#[from] role_definitions::create_or_update::Error), + #[error(transparent)] + RoleDefinitions_Delete(#[from] role_definitions::delete::Error), + #[error(transparent)] + RoleDefinitions_List(#[from] role_definitions::list::Error), + #[error(transparent)] DenyAssignments_ListForResource(#[from] deny_assignments::list_for_resource::Error), #[error(transparent)] DenyAssignments_ListForResourceGroup(#[from] deny_assignments::list_for_resource_group::Error), @@ -499,6 +514,40 @@ pub mod role_definitions { role_id: role_id.into(), } } + pub fn get(&self, scope: impl Into, role_definition_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + scope: scope.into(), + role_definition_id: role_definition_id.into(), + } + } + pub fn create_or_update( + &self, + scope: impl Into, + role_definition_id: impl Into, + role_definition: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + scope: scope.into(), + role_definition_id: role_definition_id.into(), + role_definition: role_definition.into(), + } + } + pub fn delete(&self, scope: impl Into, role_definition_id: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + scope: scope.into(), + role_definition_id: role_definition_id.into(), + } + } + pub fn list(&self, scope: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + scope: scope.into(), + filter: None, + } + } } pub mod get_by_id { use super::models; @@ -569,6 +618,514 @@ pub mod role_definitions { } } } + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) role_definition_id: 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.Authorization/roleDefinitions/{}", + self.client.endpoint(), + &self.scope, + &self.role_definition_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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RoleDefinition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) role_definition_id: String, + pub(crate) role_definition: models::RoleDefinition, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.Authorization/roleDefinitions/{}", + self.client.endpoint(), + &self.scope, + &self.role_definition_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", "2018-01-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.role_definition).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::RoleDefinition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Ok200(models::RoleDefinition), + 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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) role_definition_id: 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.Authorization/roleDefinitions/{}", + self.client.endpoint(), + &self.scope, + &self.role_definition_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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RoleDefinition = + 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::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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: 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!( + "{}/{}/providers/Microsoft.Authorization/roleDefinitions", + self.client.endpoint(), + &self.scope + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2018-01-01-preview"); + 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::RoleDefinitionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 permissions { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_for_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_for_resource_group::Builder { + list_for_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_for_resource( + &self, + resource_group_name: impl Into, + resource_provider_namespace: impl Into, + parent_resource_path: impl Into, + resource_type: impl Into, + resource_name: impl Into, + subscription_id: impl Into, + ) -> list_for_resource::Builder { + list_for_resource::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + resource_provider_namespace: resource_provider_namespace.into(), + parent_resource_path: parent_resource_path.into(), + resource_type: resource_type.into(), + resource_name: resource_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_for_resource_group { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.Authorization/permissions", + 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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PermissionGetResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_for_resource { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) resource_provider_namespace: String, + pub(crate) parent_resource_path: String, + pub(crate) resource_type: String, + pub(crate) resource_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/{}/{}/{}/{}/providers/Microsoft.Authorization/permissions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_provider_namespace, + &self.parent_resource_path, + &self.resource_type, + &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", "2018-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PermissionGetResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 deny_assignments { use super::models; diff --git a/services/mgmt/kusto/README.md b/services/mgmt/kusto/README.md index f96baf6a8f..a07ad4863b 100644 --- a/services/mgmt/kusto/README.md +++ b/services/mgmt/kusto/README.md @@ -10,7 +10,7 @@ The default tag is `package-2022-02`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: -- `package-2022-02` has 1 operations from 1 API versions: `2022-02-01`. Use crate feature `package-2022-02` to enable. The operations will be in the `package_2022_02` module. +- `package-2022-02` has 70 operations from 1 API versions: `2022-02-01`. Use crate feature `package-2022-02` to enable. The operations will be in the `package_2022_02` module. - `package-2021-08-27` has 69 operations from 1 API versions: `2021-08-27`. Use crate feature `package-2021-08-27` to enable. The operations will be in the `package_2021_08_27` module. - `package-2021-01` has 55 operations from 1 API versions: `2021-01-01`. Use crate feature `package-2021-01` to enable. The operations will be in the `package_2021_01` module. - `package-2020-09-18` has 48 operations from 1 API versions: `2020-09-18`. Use crate feature `package-2020-09-18` to enable. The operations will be in the `package_2020_09_18` module. diff --git a/services/mgmt/kusto/src/package_2022_02/operations.rs b/services/mgmt/kusto/src/package_2022_02/operations.rs index 7fa149219e..2c619141c3 100644 --- a/services/mgmt/kusto/src/package_2022_02/operations.rs +++ b/services/mgmt/kusto/src/package_2022_02/operations.rs @@ -74,9 +74,45 @@ impl Client { pipeline, } } + pub fn attached_database_configurations(&self) -> attached_database_configurations::Client { + attached_database_configurations::Client(self.clone()) + } + pub fn cluster_principal_assignments(&self) -> cluster_principal_assignments::Client { + cluster_principal_assignments::Client(self.clone()) + } + pub fn clusters(&self) -> clusters::Client { + clusters::Client(self.clone()) + } + pub fn data_connections(&self) -> data_connections::Client { + data_connections::Client(self.clone()) + } + pub fn database_principal_assignments(&self) -> database_principal_assignments::Client { + database_principal_assignments::Client(self.clone()) + } + pub fn databases(&self) -> databases::Client { + databases::Client(self.clone()) + } + pub fn managed_private_endpoints(&self) -> managed_private_endpoints::Client { + managed_private_endpoints::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn operations_results(&self) -> operations_results::Client { + operations_results::Client(self.clone()) + } pub fn operations_results_location(&self) -> operations_results_location::Client { operations_results_location::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 scripts(&self) -> scripts::Client { + scripts::Client(self.clone()) + } } #[non_exhaustive] #[derive(Debug, thiserror :: Error)] @@ -84,6 +120,144 @@ impl Client { pub enum Error { #[error(transparent)] OperationsResultsLocation_Get(#[from] operations_results_location::get::Error), + #[error(transparent)] + Clusters_Get(#[from] clusters::get::Error), + #[error(transparent)] + Clusters_CreateOrUpdate(#[from] clusters::create_or_update::Error), + #[error(transparent)] + Clusters_Update(#[from] clusters::update::Error), + #[error(transparent)] + Clusters_Delete(#[from] clusters::delete::Error), + #[error(transparent)] + Clusters_Stop(#[from] clusters::stop::Error), + #[error(transparent)] + Clusters_Start(#[from] clusters::start::Error), + #[error(transparent)] + ClusterPrincipalAssignments_CheckNameAvailability(#[from] cluster_principal_assignments::check_name_availability::Error), + #[error(transparent)] + ClusterPrincipalAssignments_Get(#[from] cluster_principal_assignments::get::Error), + #[error(transparent)] + ClusterPrincipalAssignments_CreateOrUpdate(#[from] cluster_principal_assignments::create_or_update::Error), + #[error(transparent)] + ClusterPrincipalAssignments_Delete(#[from] cluster_principal_assignments::delete::Error), + #[error(transparent)] + ClusterPrincipalAssignments_List(#[from] cluster_principal_assignments::list::Error), + #[error(transparent)] + Clusters_ListFollowerDatabases(#[from] clusters::list_follower_databases::Error), + #[error(transparent)] + Clusters_DetachFollowerDatabases(#[from] clusters::detach_follower_databases::Error), + #[error(transparent)] + Clusters_DiagnoseVirtualNetwork(#[from] clusters::diagnose_virtual_network::Error), + #[error(transparent)] + Clusters_ListByResourceGroup(#[from] clusters::list_by_resource_group::Error), + #[error(transparent)] + Clusters_List(#[from] clusters::list::Error), + #[error(transparent)] + Clusters_ListSkus(#[from] clusters::list_skus::Error), + #[error(transparent)] + Clusters_CheckNameAvailability(#[from] clusters::check_name_availability::Error), + #[error(transparent)] + Databases_CheckNameAvailability(#[from] databases::check_name_availability::Error), + #[error(transparent)] + AttachedDatabaseConfigurations_CheckNameAvailability(#[from] attached_database_configurations::check_name_availability::Error), + #[error(transparent)] + ManagedPrivateEndpoints_CheckNameAvailability(#[from] managed_private_endpoints::check_name_availability::Error), + #[error(transparent)] + Clusters_ListSkusByResource(#[from] clusters::list_skus_by_resource::Error), + #[error(transparent)] + Databases_ListByCluster(#[from] databases::list_by_cluster::Error), + #[error(transparent)] + Databases_Get(#[from] databases::get::Error), + #[error(transparent)] + Databases_CreateOrUpdate(#[from] databases::create_or_update::Error), + #[error(transparent)] + Databases_Update(#[from] databases::update::Error), + #[error(transparent)] + Databases_Delete(#[from] databases::delete::Error), + #[error(transparent)] + DatabasePrincipalAssignments_CheckNameAvailability(#[from] database_principal_assignments::check_name_availability::Error), + #[error(transparent)] + DatabasePrincipalAssignments_Get(#[from] database_principal_assignments::get::Error), + #[error(transparent)] + DatabasePrincipalAssignments_CreateOrUpdate(#[from] database_principal_assignments::create_or_update::Error), + #[error(transparent)] + DatabasePrincipalAssignments_Delete(#[from] database_principal_assignments::delete::Error), + #[error(transparent)] + DatabasePrincipalAssignments_List(#[from] database_principal_assignments::list::Error), + #[error(transparent)] + Databases_ListPrincipals(#[from] databases::list_principals::Error), + #[error(transparent)] + Databases_AddPrincipals(#[from] databases::add_principals::Error), + #[error(transparent)] + Scripts_ListByDatabase(#[from] scripts::list_by_database::Error), + #[error(transparent)] + Scripts_Get(#[from] scripts::get::Error), + #[error(transparent)] + Scripts_CreateOrUpdate(#[from] scripts::create_or_update::Error), + #[error(transparent)] + Scripts_Update(#[from] scripts::update::Error), + #[error(transparent)] + Scripts_Delete(#[from] scripts::delete::Error), + #[error(transparent)] + ManagedPrivateEndpoints_List(#[from] managed_private_endpoints::list::Error), + #[error(transparent)] + ManagedPrivateEndpoints_Get(#[from] managed_private_endpoints::get::Error), + #[error(transparent)] + ManagedPrivateEndpoints_CreateOrUpdate(#[from] managed_private_endpoints::create_or_update::Error), + #[error(transparent)] + ManagedPrivateEndpoints_Update(#[from] managed_private_endpoints::update::Error), + #[error(transparent)] + ManagedPrivateEndpoints_Delete(#[from] managed_private_endpoints::delete::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)] + PrivateLinkResources_List(#[from] private_link_resources::list::Error), + #[error(transparent)] + PrivateLinkResources_Get(#[from] private_link_resources::get::Error), + #[error(transparent)] + Clusters_ListOutboundNetworkDependenciesEndpoints(#[from] clusters::list_outbound_network_dependencies_endpoints::Error), + #[error(transparent)] + AttachedDatabaseConfigurations_ListByCluster(#[from] attached_database_configurations::list_by_cluster::Error), + #[error(transparent)] + AttachedDatabaseConfigurations_Get(#[from] attached_database_configurations::get::Error), + #[error(transparent)] + AttachedDatabaseConfigurations_CreateOrUpdate(#[from] attached_database_configurations::create_or_update::Error), + #[error(transparent)] + AttachedDatabaseConfigurations_Delete(#[from] attached_database_configurations::delete::Error), + #[error(transparent)] + Databases_RemovePrincipals(#[from] databases::remove_principals::Error), + #[error(transparent)] + DataConnections_ListByDatabase(#[from] data_connections::list_by_database::Error), + #[error(transparent)] + DataConnections_DataConnectionValidation(#[from] data_connections::data_connection_validation::Error), + #[error(transparent)] + DataConnections_CheckNameAvailability(#[from] data_connections::check_name_availability::Error), + #[error(transparent)] + Scripts_CheckNameAvailability(#[from] scripts::check_name_availability::Error), + #[error(transparent)] + DataConnections_Get(#[from] data_connections::get::Error), + #[error(transparent)] + DataConnections_CreateOrUpdate(#[from] data_connections::create_or_update::Error), + #[error(transparent)] + DataConnections_Update(#[from] data_connections::update::Error), + #[error(transparent)] + DataConnections_Delete(#[from] data_connections::delete::Error), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + Clusters_ListLanguageExtensions(#[from] clusters::list_language_extensions::Error), + #[error(transparent)] + Clusters_AddLanguageExtensions(#[from] clusters::add_language_extensions::Error), + #[error(transparent)] + Clusters_RemoveLanguageExtensions(#[from] clusters::remove_language_extensions::Error), + #[error(transparent)] + OperationsResults_Get(#[from] operations_results::get::Error), } pub mod operations_results_location { use super::models; @@ -165,3 +339,6834 @@ pub mod operations_results_location { } } } +pub mod clusters { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + cluster_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(), + cluster_name: cluster_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + if_none_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + cluster_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(), + cluster_name: cluster_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn stop( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + subscription_id: impl Into, + ) -> stop::Builder { + stop::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn start( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + subscription_id: impl Into, + ) -> start::Builder { + start::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_follower_databases( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + subscription_id: impl Into, + ) -> list_follower_databases::Builder { + list_follower_databases::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn detach_follower_databases( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + subscription_id: impl Into, + follower_database_to_remove: impl Into, + ) -> detach_follower_databases::Builder { + detach_follower_databases::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + subscription_id: subscription_id.into(), + follower_database_to_remove: follower_database_to_remove.into(), + } + } + pub fn diagnose_virtual_network( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + subscription_id: impl Into, + ) -> diagnose_virtual_network::Builder { + diagnose_virtual_network::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_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 fn list_skus(&self, subscription_id: impl Into) -> list_skus::Builder { + list_skus::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn check_name_availability( + &self, + subscription_id: impl Into, + location: impl Into, + cluster_name: impl Into, + ) -> check_name_availability::Builder { + check_name_availability::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + cluster_name: cluster_name.into(), + } + } + pub fn list_skus_by_resource( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + subscription_id: impl Into, + ) -> list_skus_by_resource::Builder { + list_skus_by_resource::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_outbound_network_dependencies_endpoints( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_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(), + cluster_name: cluster_name.into(), + } + } + pub fn list_language_extensions( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + ) -> list_language_extensions::Builder { + list_language_extensions::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + } + } + pub fn add_language_extensions( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + language_extensions_to_add: impl Into, + ) -> add_language_extensions::Builder { + add_language_extensions::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + language_extensions_to_add: language_extensions_to_add.into(), + } + } + pub fn remove_language_extensions( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + language_extensions_to_remove: impl Into, + ) -> remove_language_extensions::Builder { + remove_language_extensions::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + language_extensions_to_remove: language_extensions_to_remove.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_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.Kusto/clusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Cluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug)] + pub enum Response { + Ok200(models::Cluster), + Created201(models::Cluster), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) parameters: models::Cluster, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + pub(crate) if_none_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 if_none_match(mut self, if_none_match: impl Into) -> Self { + self.if_none_match = Some(if_none_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.Kusto/clusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_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::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", "2022-02-01"); + 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); + } + if let Some(if_none_match) = &self.if_none_match { + req_builder = req_builder.header("If-None-Match", if_none_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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Cluster = + 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::Cluster = + 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; + #[derive(Debug)] + pub enum Response { + Ok200(models::Cluster), + Created201(models::Cluster), + Accepted202(models::Cluster), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) parameters: models::ClusterUpdate, + 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.Kusto/clusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_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::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", "2022-02-01"); + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Cluster = + 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::Cluster = + 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::Cluster = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_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.Kusto/clusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_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::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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 stop { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_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.Kusto/clusters/{}/stop", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_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::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + 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 start { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_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.Kusto/clusters/{}/start", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_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::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + 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 list_follower_databases { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_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.Kusto/clusters/{}/listFollowerDatabases", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_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::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + 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::FollowerDatabaseListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod detach_follower_databases { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) subscription_id: String, + pub(crate) follower_database_to_remove: models::FollowerDatabaseDefinition, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/detachFollowerDatabases", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_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::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.follower_database_to_remove).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 diagnose_virtual_network { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::DiagnoseVirtualNetworkResult), + 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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_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.Kusto/clusters/{}/diagnoseVirtualNetwork", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_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::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + 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::DiagnoseVirtualNetworkResult = + 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_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.Kusto/clusters", + 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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClusterListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.Kusto/clusters", + 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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClusterListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.Kusto/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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SkuDescriptionList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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) cluster_name: models::ClusterCheckNameRequest, + } + 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.Kusto/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", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.cluster_name).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CheckNameResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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_by_resource { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_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.Kusto/clusters/{}/skus", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListResourceSkusResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/outboundNetworkDependenciesEndpoints", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OutboundNetworkDependenciesEndpointListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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_language_extensions { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/listLanguageExtensions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_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::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + 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::LanguageExtensionsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod add_language_extensions { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_name: String, + pub(crate) language_extensions_to_add: models::LanguageExtensionsList, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/addLanguageExtensions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_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::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.language_extensions_to_add).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 remove_language_extensions { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_name: String, + pub(crate) language_extensions_to_remove: models::LanguageExtensionsList, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/removeLanguageExtensions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_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::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.language_extensions_to_remove).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 cluster_principal_assignments { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn check_name_availability( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + subscription_id: impl Into, + principal_assignment_name: impl Into, + ) -> check_name_availability::Builder { + check_name_availability::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + subscription_id: subscription_id.into(), + principal_assignment_name: principal_assignment_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + principal_assignment_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + principal_assignment_name: principal_assignment_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + principal_assignment_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(), + cluster_name: cluster_name.into(), + principal_assignment_name: principal_assignment_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + principal_assignment_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + principal_assignment_name: principal_assignment_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_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_name: cluster_name.into(), + } + } + } + pub mod check_name_availability { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) subscription_id: String, + pub(crate) principal_assignment_name: models::ClusterPrincipalAssignmentCheckNameRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/checkPrincipalAssignmentNameAvailability" , self . client . endpoint () , & self . subscription_id , & self . resource_group_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::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.principal_assignment_name).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CheckNameResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_name: String, + pub(crate) principal_assignment_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/principalAssignments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.principal_assignment_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClusterPrincipalAssignment = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug)] + pub enum Response { + Ok200(models::ClusterPrincipalAssignment), + Created201(models::ClusterPrincipalAssignment), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_name: String, + pub(crate) principal_assignment_name: String, + pub(crate) parameters: models::ClusterPrincipalAssignment, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/principalAssignments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.principal_assignment_name + ); + let mut url = 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", "2022-02-01"); + 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::ClusterPrincipalAssignment = + 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::ClusterPrincipalAssignment = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_name: String, + pub(crate) principal_assignment_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/principalAssignments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.principal_assignment_name + ); + let mut url = 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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/principalAssignments", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClusterPrincipalAssignmentListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod databases { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn check_name_availability( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + subscription_id: impl Into, + resource_name: impl Into, + ) -> check_name_availability::Builder { + check_name_availability::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + subscription_id: subscription_id.into(), + resource_name: resource_name.into(), + } + } + pub fn list_by_cluster( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + subscription_id: impl Into, + ) -> list_by_cluster::Builder { + list_by_cluster::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + database_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + database_name: database_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + database_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(), + cluster_name: cluster_name.into(), + database_name: database_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + database_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(), + cluster_name: cluster_name.into(), + database_name: database_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + database_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + database_name: database_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_principals( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + database_name: impl Into, + subscription_id: impl Into, + ) -> list_principals::Builder { + list_principals::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + database_name: database_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn add_principals( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + database_name: impl Into, + subscription_id: impl Into, + database_principals_to_add: impl Into, + ) -> add_principals::Builder { + add_principals::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + database_name: database_name.into(), + subscription_id: subscription_id.into(), + database_principals_to_add: database_principals_to_add.into(), + } + } + pub fn remove_principals( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + database_name: impl Into, + subscription_id: impl Into, + database_principals_to_remove: impl Into, + ) -> remove_principals::Builder { + remove_principals::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + database_name: database_name.into(), + subscription_id: subscription_id.into(), + database_principals_to_remove: database_principals_to_remove.into(), + } + } + } + pub mod check_name_availability { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_name: models::CheckNameRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/checkNameAvailability", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_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::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.resource_name).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CheckNameResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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_cluster { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_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.Kusto/clusters/{}/databases", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DatabaseListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) database_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.Kusto/clusters/{}/databases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.database_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Database = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug)] + pub enum Response { + Ok200(models::Database), + Created201(models::Database), + Accepted202(models::Database), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) database_name: String, + pub(crate) parameters: models::Database, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/databases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.database_name + ); + let mut url = 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", "2022-02-01"); + 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::Database = + 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::Database = + 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::Database = + 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; + #[derive(Debug)] + pub enum Response { + Ok200(models::Database), + Created201(models::Database), + Accepted202(models::Database), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) database_name: String, + pub(crate) parameters: models::Database, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/databases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.database_name + ); + let mut url = 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", "2022-02-01"); + 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::Database = + 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::Database = + 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::Database = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) database_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.Kusto/clusters/{}/databases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.database_name + ); + let mut url = 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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_principals { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) database_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.Kusto/clusters/{}/databases/{}/listPrincipals", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.database_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + 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::DatabasePrincipalListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod add_principals { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) database_name: String, + pub(crate) subscription_id: String, + pub(crate) database_principals_to_add: models::DatabasePrincipalListRequest, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/databases/{}/addPrincipals", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.database_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.database_principals_to_add).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DatabasePrincipalListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod remove_principals { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) database_name: String, + pub(crate) subscription_id: String, + pub(crate) database_principals_to_remove: models::DatabasePrincipalListRequest, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/databases/{}/removePrincipals", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.database_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.database_principals_to_remove).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DatabasePrincipalListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod attached_database_configurations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn check_name_availability( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + subscription_id: impl Into, + resource_name: impl Into, + ) -> check_name_availability::Builder { + check_name_availability::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + subscription_id: subscription_id.into(), + resource_name: resource_name.into(), + } + } + pub fn list_by_cluster( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + subscription_id: impl Into, + ) -> list_by_cluster::Builder { + list_by_cluster::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + attached_database_configuration_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + attached_database_configuration_name: attached_database_configuration_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + attached_database_configuration_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(), + cluster_name: cluster_name.into(), + attached_database_configuration_name: attached_database_configuration_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + attached_database_configuration_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + attached_database_configuration_name: attached_database_configuration_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod check_name_availability { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_name: models::AttachedDatabaseConfigurationsCheckNameRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/attachedDatabaseConfigurationCheckNameAvailability" , self . client . endpoint () , & self . subscription_id , & self . resource_group_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::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.resource_name).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CheckNameResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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_cluster { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_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.Kusto/clusters/{}/attachedDatabaseConfigurations", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AttachedDatabaseConfigurationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) attached_database_configuration_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.Kusto/clusters/{}/attachedDatabaseConfigurations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.attached_database_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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AttachedDatabaseConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug)] + pub enum Response { + Ok200(models::AttachedDatabaseConfiguration), + Created201(models::AttachedDatabaseConfiguration), + Accepted202(models::AttachedDatabaseConfiguration), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) attached_database_configuration_name: String, + pub(crate) parameters: models::AttachedDatabaseConfiguration, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/attachedDatabaseConfigurations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.attached_database_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", "2022-02-01"); + 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::AttachedDatabaseConfiguration = + 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::AttachedDatabaseConfiguration = + 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::AttachedDatabaseConfiguration = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) attached_database_configuration_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.Kusto/clusters/{}/attachedDatabaseConfigurations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.attached_database_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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 managed_private_endpoints { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn check_name_availability( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + subscription_id: impl Into, + resource_name: impl Into, + ) -> check_name_availability::Builder { + check_name_availability::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + subscription_id: subscription_id.into(), + resource_name: resource_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_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_name: cluster_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + managed_private_endpoint_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + managed_private_endpoint_name: managed_private_endpoint_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + managed_private_endpoint_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(), + cluster_name: cluster_name.into(), + managed_private_endpoint_name: managed_private_endpoint_name.into(), + parameters: parameters.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + managed_private_endpoint_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(), + cluster_name: cluster_name.into(), + managed_private_endpoint_name: managed_private_endpoint_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + managed_private_endpoint_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + managed_private_endpoint_name: managed_private_endpoint_name.into(), + } + } + } + pub mod check_name_availability { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_name: models::ManagedPrivateEndpointsCheckNameRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/managedPrivateEndpointsCheckNameAvailability" , self . client . endpoint () , & self . subscription_id , & self . resource_group_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::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.resource_name).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CheckNameResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/managedPrivateEndpoints", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedPrivateEndpointListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_name: String, + pub(crate) managed_private_endpoint_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/managedPrivateEndpoints/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.managed_private_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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedPrivateEndpoint = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug)] + pub enum Response { + Ok200(models::ManagedPrivateEndpoint), + Created201(models::ManagedPrivateEndpoint), + Accepted202(models::ManagedPrivateEndpoint), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_name: String, + pub(crate) managed_private_endpoint_name: String, + pub(crate) parameters: models::ManagedPrivateEndpoint, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/managedPrivateEndpoints/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.managed_private_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", "2022-02-01"); + 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::ManagedPrivateEndpoint = + 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::ManagedPrivateEndpoint = + 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::ManagedPrivateEndpoint = + 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; + #[derive(Debug)] + pub enum Response { + Ok200(models::ManagedPrivateEndpoint), + Accepted202(models::ManagedPrivateEndpoint), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_name: String, + pub(crate) managed_private_endpoint_name: String, + pub(crate) parameters: models::ManagedPrivateEndpoint, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/managedPrivateEndpoints/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.managed_private_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", "2022-02-01"); + 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::ManagedPrivateEndpoint = + 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::ManagedPrivateEndpoint = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_name: String, + pub(crate) managed_private_endpoint_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/managedPrivateEndpoints/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.managed_private_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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 database_principal_assignments { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn check_name_availability( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + database_name: impl Into, + subscription_id: impl Into, + principal_assignment_name: impl Into, + ) -> check_name_availability::Builder { + check_name_availability::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + database_name: database_name.into(), + subscription_id: subscription_id.into(), + principal_assignment_name: principal_assignment_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + database_name: impl Into, + principal_assignment_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + database_name: database_name.into(), + principal_assignment_name: principal_assignment_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + database_name: impl Into, + principal_assignment_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(), + cluster_name: cluster_name.into(), + database_name: database_name.into(), + principal_assignment_name: principal_assignment_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + database_name: impl Into, + principal_assignment_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + database_name: database_name.into(), + principal_assignment_name: principal_assignment_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + database_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + database_name: database_name.into(), + } + } + } + pub mod check_name_availability { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) database_name: String, + pub(crate) subscription_id: String, + pub(crate) principal_assignment_name: models::DatabasePrincipalAssignmentCheckNameRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/databases/{}/checkPrincipalAssignmentNameAvailability" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_name , & self . database_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.principal_assignment_name).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CheckNameResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_name: String, + pub(crate) database_name: String, + pub(crate) principal_assignment_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/databases/{}/principalAssignments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.database_name, + &self.principal_assignment_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DatabasePrincipalAssignment = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug)] + pub enum Response { + Ok200(models::DatabasePrincipalAssignment), + Created201(models::DatabasePrincipalAssignment), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_name: String, + pub(crate) database_name: String, + pub(crate) principal_assignment_name: String, + pub(crate) parameters: models::DatabasePrincipalAssignment, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/databases/{}/principalAssignments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.database_name, + &self.principal_assignment_name + ); + let mut url = 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", "2022-02-01"); + 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::DatabasePrincipalAssignment = + 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::DatabasePrincipalAssignment = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_name: String, + pub(crate) database_name: String, + pub(crate) principal_assignment_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/databases/{}/principalAssignments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.database_name, + &self.principal_assignment_name + ); + let mut url = 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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_name: String, + pub(crate) database_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/databases/{}/principalAssignments", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.database_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DatabasePrincipalAssignmentListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod scripts { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_database( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + database_name: impl Into, + ) -> list_by_database::Builder { + list_by_database::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + database_name: database_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + database_name: impl Into, + script_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + database_name: database_name.into(), + script_name: script_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + database_name: impl Into, + script_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(), + cluster_name: cluster_name.into(), + database_name: database_name.into(), + script_name: script_name.into(), + parameters: parameters.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + database_name: impl Into, + script_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(), + cluster_name: cluster_name.into(), + database_name: database_name.into(), + script_name: script_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + database_name: impl Into, + script_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + database_name: database_name.into(), + script_name: script_name.into(), + } + } + pub fn check_name_availability( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + database_name: impl Into, + subscription_id: impl Into, + script_name: impl Into, + ) -> check_name_availability::Builder { + check_name_availability::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + database_name: database_name.into(), + subscription_id: subscription_id.into(), + script_name: script_name.into(), + } + } + } + pub mod list_by_database { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_name: String, + pub(crate) database_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/databases/{}/scripts", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.database_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ScriptListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_name: String, + pub(crate) database_name: String, + pub(crate) script_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/databases/{}/scripts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.database_name, + &self.script_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Script = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug)] + pub enum Response { + Ok200(models::Script), + Created201(models::Script), + Accepted202(models::Script), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_name: String, + pub(crate) database_name: String, + pub(crate) script_name: String, + pub(crate) parameters: models::Script, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/databases/{}/scripts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.database_name, + &self.script_name + ); + let mut url = 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", "2022-02-01"); + 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::Script = + 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::Script = + 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::Script = + 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; + #[derive(Debug)] + pub enum Response { + Ok200(models::Script), + Accepted202(models::Script), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_name: String, + pub(crate) database_name: String, + pub(crate) script_name: String, + pub(crate) parameters: models::Script, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/databases/{}/scripts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.database_name, + &self.script_name + ); + let mut url = 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", "2022-02-01"); + 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::Script = + 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::Script = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_name: String, + pub(crate) database_name: String, + pub(crate) script_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/databases/{}/scripts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.database_name, + &self.script_name + ); + let mut url = 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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) database_name: String, + pub(crate) subscription_id: String, + pub(crate) script_name: models::ScriptCheckNameRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/databases/{}/scriptsCheckNameAvailability" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_name , & self . database_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.script_name).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CheckNameResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_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_name: cluster_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_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(), + cluster_name: cluster_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, + cluster_name: impl Into, + private_endpoint_connection_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(), + cluster_name: cluster_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_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(), + cluster_name: cluster_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/privateEndpointConnections", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match 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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_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.Kusto/clusters/{}/privateEndpointConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match 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 create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::PrivateEndpointConnection), + Created201(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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_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.Kusto/clusters/{}/privateEndpointConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_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", "2022-02-01"); + 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(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)?; + let rsp_value: models::CloudError = + serde_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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_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.Kusto/clusters/{}/privateEndpointConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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_link_resources { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_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_name: cluster_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_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(), + cluster_name: cluster_name.into(), + private_link_resource_name: private_link_resource_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/privateLinkResources", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match 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::CloudError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[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_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.Kusto/clusters/{}/privateLinkResources/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match 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 data_connections { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_database( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + database_name: impl Into, + subscription_id: impl Into, + ) -> list_by_database::Builder { + list_by_database::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + database_name: database_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn data_connection_validation( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + database_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> data_connection_validation::Builder { + data_connection_validation::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + database_name: database_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + pub fn check_name_availability( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + database_name: impl Into, + subscription_id: impl Into, + data_connection_name: impl Into, + ) -> check_name_availability::Builder { + check_name_availability::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + database_name: database_name.into(), + subscription_id: subscription_id.into(), + data_connection_name: data_connection_name.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + database_name: impl Into, + data_connection_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + database_name: database_name.into(), + data_connection_name: data_connection_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + database_name: impl Into, + data_connection_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(), + cluster_name: cluster_name.into(), + database_name: database_name.into(), + data_connection_name: data_connection_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + database_name: impl Into, + data_connection_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(), + cluster_name: cluster_name.into(), + database_name: database_name.into(), + data_connection_name: data_connection_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + cluster_name: impl Into, + database_name: impl Into, + data_connection_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + database_name: database_name.into(), + data_connection_name: data_connection_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_database { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) database_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.Kusto/clusters/{}/databases/{}/dataConnections", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.database_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataConnectionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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_connection_validation { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::DataConnectionValidationListResult), + 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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) database_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::DataConnectionValidation, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/databases/{}/dataConnectionValidation", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.database_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + 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::DataConnectionValidationListResult = + 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 check_name_availability { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) database_name: String, + pub(crate) subscription_id: String, + pub(crate) data_connection_name: models::DataConnectionCheckNameRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/databases/{}/checkNameAvailability", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.database_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.data_connection_name).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CheckNameResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) database_name: String, + pub(crate) data_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.Kusto/clusters/{}/databases/{}/dataConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.database_name, + &self.data_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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug)] + pub enum Response { + Ok200(models::DataConnection), + Created201(models::DataConnection), + Accepted202(models::DataConnection), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) database_name: String, + pub(crate) data_connection_name: String, + pub(crate) parameters: models::DataConnection, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/databases/{}/dataConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.database_name, + &self.data_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", "2022-02-01"); + 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::DataConnection = + 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::DataConnection = + 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::DataConnection = + 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; + #[derive(Debug)] + pub enum Response { + Ok200(models::DataConnection), + Created201(models::DataConnection), + Accepted202(models::DataConnection), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) database_name: String, + pub(crate) data_connection_name: String, + pub(crate) parameters: models::DataConnection, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Kusto/clusters/{}/databases/{}/dataConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.database_name, + &self.data_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::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", "2022-02-01"); + 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::DataConnection = + 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::DataConnection = + 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::DataConnection = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) database_name: String, + pub(crate) data_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.Kusto/clusters/{}/databases/{}/dataConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.database_name, + &self.data_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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 operations { + use super::models; + 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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.Kusto/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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match 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 operations_results { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + 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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.Kusto/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", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::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/policyinsights/README.md b/services/mgmt/policyinsights/README.md index e840ce3e7d..cf42b07b32 100644 --- a/services/mgmt/policyinsights/README.md +++ b/services/mgmt/policyinsights/README.md @@ -10,11 +10,11 @@ The default tag is `package-2022-03`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: -- `package-2022-03` has 47 operations from 5 API versions: `2018-07-01-preview`, `2019-10-01`, `2021-01-01`, `2021-10-01`, `2022-03-01`. Use crate feature `package-2022-03` to enable. The operations will be in the `package_2022_03` module. -- `package-2021-10` has 46 operations from 5 API versions: `2018-07-01-preview`, `2019-10-01`, `2020-07-01`, `2021-01-01`, `2021-10-01`. Use crate feature `package-2021-10` to enable. The operations will be in the `package_2021_10` module. -- `package-2021-01` has 46 operations from 5 API versions: `2018-07-01-preview`, `2019-07-01`, `2019-10-01`, `2020-07-01`, `2021-01-01`. Use crate feature `package-2021-01` to enable. The operations will be in the `package_2021_01` module. -- `package-2020-07` has 34 operations from 4 API versions: `2018-07-01-preview`, `2019-07-01`, `2019-10-01`, `2020-07-01`. Use crate feature `package-2020-07` to enable. The operations will be in the `package_2020_07` module. -- `package-2020-07-preview` has 34 operations from 4 API versions: `2018-07-01-preview`, `2019-07-01`, `2019-10-01`, `2020-07-01-preview`. Use crate feature `package-2020-07-preview` to enable. The operations will be in the `package_2020_07_preview` module. -- `package-2019-10` has 32 operations from 3 API versions: `2018-07-01-preview`, `2019-07-01`, `2019-10-01`. Use crate feature `package-2019-10` to enable. The operations will be in the `package_2019_10` module. +- `package-2022-03` has 74 operations from 5 API versions: `2018-07-01-preview`, `2019-10-01`, `2021-01-01`, `2021-10-01`, `2022-03-01`. Use crate feature `package-2022-03` to enable. The operations will be in the `package_2022_03` module. +- `package-2021-10` has 73 operations from 5 API versions: `2018-07-01-preview`, `2019-10-01`, `2020-07-01`, `2021-01-01`, `2021-10-01`. Use crate feature `package-2021-10` to enable. The operations will be in the `package_2021_10` module. +- `package-2021-01` has 73 operations from 5 API versions: `2018-07-01-preview`, `2019-07-01`, `2019-10-01`, `2020-07-01`, `2021-01-01`. Use crate feature `package-2021-01` to enable. The operations will be in the `package_2021_01` module. +- `package-2020-07` has 61 operations from 4 API versions: `2018-07-01-preview`, `2019-07-01`, `2019-10-01`, `2020-07-01`. Use crate feature `package-2020-07` to enable. The operations will be in the `package_2020_07` module. +- `package-2020-07-preview` has 61 operations from 4 API versions: `2018-07-01-preview`, `2019-07-01`, `2019-10-01`, `2020-07-01-preview`. Use crate feature `package-2020-07-preview` to enable. The operations will be in the `package_2020_07_preview` module. +- `package-2019-10` has 59 operations from 3 API versions: `2018-07-01-preview`, `2019-07-01`, `2019-10-01`. Use crate feature `package-2019-10` to enable. The operations will be in the `package_2019_10` module. - `package-2018-07` has 54 operations from 1 API versions: `2018-07-01-preview`. Use crate feature `package-2018-07` to enable. The operations will be in the `package_2018_07` module. - `package-2018-04` has 27 operations from 1 API versions: `2018-04-04`. Use crate feature `package-2018-04` to enable. The operations will be in the `package_2018_04` module. \ No newline at end of file diff --git a/services/mgmt/policyinsights/src/package_2019_10/operations.rs b/services/mgmt/policyinsights/src/package_2019_10/operations.rs index e9c1b34216..2015eba02c 100644 --- a/services/mgmt/policyinsights/src/package_2019_10/operations.rs +++ b/services/mgmt/policyinsights/src/package_2019_10/operations.rs @@ -74,6 +74,9 @@ impl Client { pipeline, } } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } pub fn policy_events(&self) -> policy_events::Client { policy_events::Client(self.clone()) } @@ -155,8 +158,74 @@ pub enum Error { #[error(transparent)] PolicyEvents_NextLink(#[from] policy_events::next_link::Error), #[error(transparent)] + PolicyEvents_ListQueryResultsForManagementGroup(#[from] policy_events::list_query_results_for_management_group::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForSubscription(#[from] policy_events::list_query_results_for_subscription::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForResourceGroup(#[from] policy_events::list_query_results_for_resource_group::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForResource(#[from] policy_events::list_query_results_for_resource::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForPolicySetDefinition(#[from] policy_events::list_query_results_for_policy_set_definition::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForPolicyDefinition(#[from] policy_events::list_query_results_for_policy_definition::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForSubscriptionLevelPolicyAssignment( + #[from] policy_events::list_query_results_for_subscription_level_policy_assignment::Error, + ), + #[error(transparent)] + PolicyEvents_ListQueryResultsForResourceGroupLevelPolicyAssignment( + #[from] policy_events::list_query_results_for_resource_group_level_policy_assignment::Error, + ), + #[error(transparent)] PolicyStates_NextLink(#[from] policy_states::next_link::Error), #[error(transparent)] + PolicyStates_ListQueryResultsForManagementGroup(#[from] policy_states::list_query_results_for_management_group::Error), + #[error(transparent)] + PolicyStates_SummarizeForManagementGroup(#[from] policy_states::summarize_for_management_group::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForSubscription(#[from] policy_states::list_query_results_for_subscription::Error), + #[error(transparent)] + PolicyStates_SummarizeForSubscription(#[from] policy_states::summarize_for_subscription::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForResourceGroup(#[from] policy_states::list_query_results_for_resource_group::Error), + #[error(transparent)] + PolicyStates_SummarizeForResourceGroup(#[from] policy_states::summarize_for_resource_group::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForResource(#[from] policy_states::list_query_results_for_resource::Error), + #[error(transparent)] + PolicyStates_SummarizeForResource(#[from] policy_states::summarize_for_resource::Error), + #[error(transparent)] + PolicyStates_TriggerSubscriptionEvaluation(#[from] policy_states::trigger_subscription_evaluation::Error), + #[error(transparent)] + PolicyStates_TriggerResourceGroupEvaluation(#[from] policy_states::trigger_resource_group_evaluation::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForPolicySetDefinition(#[from] policy_states::list_query_results_for_policy_set_definition::Error), + #[error(transparent)] + PolicyStates_SummarizeForPolicySetDefinition(#[from] policy_states::summarize_for_policy_set_definition::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForPolicyDefinition(#[from] policy_states::list_query_results_for_policy_definition::Error), + #[error(transparent)] + PolicyStates_SummarizeForPolicyDefinition(#[from] policy_states::summarize_for_policy_definition::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForSubscriptionLevelPolicyAssignment( + #[from] policy_states::list_query_results_for_subscription_level_policy_assignment::Error, + ), + #[error(transparent)] + PolicyStates_SummarizeForSubscriptionLevelPolicyAssignment( + #[from] policy_states::summarize_for_subscription_level_policy_assignment::Error, + ), + #[error(transparent)] + PolicyStates_ListQueryResultsForResourceGroupLevelPolicyAssignment( + #[from] policy_states::list_query_results_for_resource_group_level_policy_assignment::Error, + ), + #[error(transparent)] + PolicyStates_SummarizeForResourceGroupLevelPolicyAssignment( + #[from] policy_states::summarize_for_resource_group_level_policy_assignment::Error, + ), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] PolicyMetadata_GetResource(#[from] policy_metadata::get_resource::Error), #[error(transparent)] PolicyMetadata_List(#[from] policy_metadata::list::Error), @@ -2914,6 +2983,181 @@ pub mod policy_events { skiptoken: None, } } + pub fn list_query_results_for_management_group( + &self, + policy_events_resource: impl Into, + management_groups_namespace: impl Into, + management_group_name: impl Into, + ) -> list_query_results_for_management_group::Builder { + list_query_results_for_management_group::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + management_groups_namespace: management_groups_namespace.into(), + management_group_name: management_group_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_subscription( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + ) -> list_query_results_for_subscription::Builder { + list_query_results_for_subscription::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_resource_group( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_query_results_for_resource_group::Builder { + list_query_results_for_resource_group::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_resource( + &self, + policy_events_resource: impl Into, + resource_id: impl Into, + ) -> list_query_results_for_resource::Builder { + list_query_results_for_resource::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + resource_id: resource_id.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + expand: None, + skiptoken: None, + } + } + pub fn list_query_results_for_policy_set_definition( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_set_definition_name: impl Into, + ) -> list_query_results_for_policy_set_definition::Builder { + list_query_results_for_policy_set_definition::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_set_definition_name: policy_set_definition_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_policy_definition( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_definition_name: impl Into, + ) -> list_query_results_for_policy_definition::Builder { + list_query_results_for_policy_definition::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_definition_name: policy_definition_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_subscription_level_policy_assignment( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> list_query_results_for_subscription_level_policy_assignment::Builder { + list_query_results_for_subscription_level_policy_assignment::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_resource_group_level_policy_assignment( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> list_query_results_for_resource_group_level_policy_assignment::Builder { + list_query_results_for_resource_group_level_policy_assignment::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } } pub mod next_link { use super::models; @@ -2993,20 +3237,7 @@ pub mod policy_events { } } } -} -pub mod policy_states { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn next_link(&self, next_link: impl Into) -> next_link::Builder { - next_link::Builder { - client: self.0.clone(), - next_link: next_link.into(), - skiptoken: None, - } - } - } - pub mod next_link { + pub mod list_query_results_for_management_group { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3033,17 +3264,60 @@ pub mod policy_states { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) next_link: String, + pub(crate) policy_events_resource: String, + pub(crate) management_groups_namespace: String, + pub(crate) management_group_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, pub(crate) skiptoken: Option, } impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { self.skiptoken = Some(skiptoken.into()); self } - 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!("{}{}?Next paging op for policy states", self.client.endpoint(), &self.next_link); + let url_str = &format!( + "{}/providers/{}/managementGroups/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults", + self.client.endpoint(), + &self.management_groups_namespace, + &self.management_group_name, + &self.policy_events_resource + ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::POST); @@ -3054,6 +3328,27 @@ pub mod policy_states { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } if let Some(skiptoken) = &self.skiptoken { url.query_pairs_mut().append_pair("$skiptoken", skiptoken); } @@ -3066,7 +3361,3618 @@ pub mod policy_states { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PolicyStatesQueryResults = + let rsp_value: models::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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.PolicyInsights/policyEvents/{}/queryResults", + self.client.endpoint(), + &self.subscription_id, + &self.policy_events_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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.PolicyInsights/policyEvents/{}/queryResults", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.policy_events_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) resource_id: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) expand: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults", + self.client.endpoint(), + &self.resource_id, + &self.policy_events_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_policy_set_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_set_definition_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policySetDefinitions/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_set_definition_name , & self . policy_events_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_policy_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_definition_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policyDefinitions/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_definition_name , & self . policy_events_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_subscription_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_events_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource_group_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_events_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod policy_states { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn next_link(&self, next_link: impl Into) -> next_link::Builder { + next_link::Builder { + client: self.0.clone(), + next_link: next_link.into(), + skiptoken: None, + } + } + pub fn list_query_results_for_management_group( + &self, + policy_states_resource: impl Into, + management_groups_namespace: impl Into, + management_group_name: impl Into, + ) -> list_query_results_for_management_group::Builder { + list_query_results_for_management_group::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + management_groups_namespace: management_groups_namespace.into(), + management_group_name: management_group_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_management_group( + &self, + policy_states_summary_resource: impl Into, + management_groups_namespace: impl Into, + management_group_name: impl Into, + ) -> summarize_for_management_group::Builder { + summarize_for_management_group::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + management_groups_namespace: management_groups_namespace.into(), + management_group_name: management_group_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_subscription( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + ) -> list_query_results_for_subscription::Builder { + list_query_results_for_subscription::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_subscription( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + ) -> summarize_for_subscription::Builder { + summarize_for_subscription::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_resource_group( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_query_results_for_resource_group::Builder { + list_query_results_for_resource_group::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_resource_group( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> summarize_for_resource_group::Builder { + summarize_for_resource_group::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_resource( + &self, + policy_states_resource: impl Into, + resource_id: impl Into, + ) -> list_query_results_for_resource::Builder { + list_query_results_for_resource::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + resource_id: resource_id.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + expand: None, + skiptoken: None, + } + } + pub fn summarize_for_resource( + &self, + policy_states_summary_resource: impl Into, + resource_id: impl Into, + ) -> summarize_for_resource::Builder { + summarize_for_resource::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + resource_id: resource_id.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn trigger_subscription_evaluation(&self, subscription_id: impl Into) -> trigger_subscription_evaluation::Builder { + trigger_subscription_evaluation::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn trigger_resource_group_evaluation( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> trigger_resource_group_evaluation::Builder { + trigger_resource_group_evaluation::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn list_query_results_for_policy_set_definition( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_set_definition_name: impl Into, + ) -> list_query_results_for_policy_set_definition::Builder { + list_query_results_for_policy_set_definition::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_set_definition_name: policy_set_definition_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_policy_set_definition( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_set_definition_name: impl Into, + ) -> summarize_for_policy_set_definition::Builder { + summarize_for_policy_set_definition::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_set_definition_name: policy_set_definition_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_policy_definition( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_definition_name: impl Into, + ) -> list_query_results_for_policy_definition::Builder { + list_query_results_for_policy_definition::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_definition_name: policy_definition_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_policy_definition( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_definition_name: impl Into, + ) -> summarize_for_policy_definition::Builder { + summarize_for_policy_definition::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_definition_name: policy_definition_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_subscription_level_policy_assignment( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> list_query_results_for_subscription_level_policy_assignment::Builder { + list_query_results_for_subscription_level_policy_assignment::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_subscription_level_policy_assignment( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> summarize_for_subscription_level_policy_assignment::Builder { + summarize_for_subscription_level_policy_assignment::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_resource_group_level_policy_assignment( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> list_query_results_for_resource_group_level_policy_assignment::Builder { + list_query_results_for_resource_group_level_policy_assignment::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_resource_group_level_policy_assignment( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> summarize_for_resource_group_level_policy_assignment::Builder { + summarize_for_resource_group_level_policy_assignment::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + } + pub mod next_link { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) next_link: String, + pub(crate) skiptoken: Option, + } + impl Builder { + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}{}?Next paging op for policy states", self.client.endpoint(), &self.next_link); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_management_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) management_groups_namespace: String, + pub(crate) management_group_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/{}/managementGroups/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults", + self.client.endpoint(), + &self.management_groups_namespace, + &self.management_group_name, + &self.policy_states_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_management_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) management_groups_namespace: String, + pub(crate) management_group_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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!( + "{}/providers/{}/managementGroups/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize", + self.client.endpoint(), + &self.management_groups_namespace, + &self.management_group_name, + &self.policy_states_summary_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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.PolicyInsights/policyStates/{}/queryResults", + self.client.endpoint(), + &self.subscription_id, + &self.policy_states_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize", + self.client.endpoint(), + &self.subscription_id, + &self.policy_states_summary_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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.PolicyInsights/policyStates/{}/queryResults", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.policy_states_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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.PolicyInsights/policyStates/{}/summarize", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.policy_states_summary_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) resource_id: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) expand: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults", + self.client.endpoint(), + &self.resource_id, + &self.policy_states_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_resource { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) resource_id: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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!( + "{}/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize", + self.client.endpoint(), + &self.resource_id, + &self.policy_states_summary_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_subscription_evaluation { + use super::models; + #[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::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.PolicyInsights/policyStates/latest/triggerEvaluation", + 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", "2019-10-01"); + 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::QueryFailure = + serde_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_resource_group_evaluation { + use super::models; + #[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::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, 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.PolicyInsights/policyStates/latest/triggerEvaluation", + 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::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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::QueryFailure = + serde_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_query_results_for_policy_set_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_set_definition_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policySetDefinitions/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_set_definition_name , & self . policy_states_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_policy_set_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_set_definition_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/providers/{}/policySetDefinitions/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_set_definition_name , & self . policy_states_summary_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_policy_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_definition_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policyDefinitions/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_definition_name , & self . policy_states_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_policy_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_definition_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/providers/{}/policyDefinitions/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_definition_name , & self . policy_states_summary_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_subscription_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_states_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_subscription_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/providers/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_states_summary_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource_group_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_states_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_resource_group_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_states_summary_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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; + 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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.PolicyInsights/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", "2019-10-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationsListResults = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } diff --git a/services/mgmt/policyinsights/src/package_2020_07/operations.rs b/services/mgmt/policyinsights/src/package_2020_07/operations.rs index 2937e789a8..4f133a2dc2 100644 --- a/services/mgmt/policyinsights/src/package_2020_07/operations.rs +++ b/services/mgmt/policyinsights/src/package_2020_07/operations.rs @@ -74,6 +74,9 @@ impl Client { pipeline, } } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } pub fn policy_events(&self) -> policy_events::Client { policy_events::Client(self.clone()) } @@ -158,8 +161,74 @@ pub enum Error { #[error(transparent)] PolicyEvents_NextLink(#[from] policy_events::next_link::Error), #[error(transparent)] + PolicyEvents_ListQueryResultsForManagementGroup(#[from] policy_events::list_query_results_for_management_group::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForSubscription(#[from] policy_events::list_query_results_for_subscription::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForResourceGroup(#[from] policy_events::list_query_results_for_resource_group::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForResource(#[from] policy_events::list_query_results_for_resource::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForPolicySetDefinition(#[from] policy_events::list_query_results_for_policy_set_definition::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForPolicyDefinition(#[from] policy_events::list_query_results_for_policy_definition::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForSubscriptionLevelPolicyAssignment( + #[from] policy_events::list_query_results_for_subscription_level_policy_assignment::Error, + ), + #[error(transparent)] + PolicyEvents_ListQueryResultsForResourceGroupLevelPolicyAssignment( + #[from] policy_events::list_query_results_for_resource_group_level_policy_assignment::Error, + ), + #[error(transparent)] PolicyStates_NextLink(#[from] policy_states::next_link::Error), #[error(transparent)] + PolicyStates_ListQueryResultsForManagementGroup(#[from] policy_states::list_query_results_for_management_group::Error), + #[error(transparent)] + PolicyStates_SummarizeForManagementGroup(#[from] policy_states::summarize_for_management_group::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForSubscription(#[from] policy_states::list_query_results_for_subscription::Error), + #[error(transparent)] + PolicyStates_SummarizeForSubscription(#[from] policy_states::summarize_for_subscription::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForResourceGroup(#[from] policy_states::list_query_results_for_resource_group::Error), + #[error(transparent)] + PolicyStates_SummarizeForResourceGroup(#[from] policy_states::summarize_for_resource_group::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForResource(#[from] policy_states::list_query_results_for_resource::Error), + #[error(transparent)] + PolicyStates_SummarizeForResource(#[from] policy_states::summarize_for_resource::Error), + #[error(transparent)] + PolicyStates_TriggerSubscriptionEvaluation(#[from] policy_states::trigger_subscription_evaluation::Error), + #[error(transparent)] + PolicyStates_TriggerResourceGroupEvaluation(#[from] policy_states::trigger_resource_group_evaluation::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForPolicySetDefinition(#[from] policy_states::list_query_results_for_policy_set_definition::Error), + #[error(transparent)] + PolicyStates_SummarizeForPolicySetDefinition(#[from] policy_states::summarize_for_policy_set_definition::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForPolicyDefinition(#[from] policy_states::list_query_results_for_policy_definition::Error), + #[error(transparent)] + PolicyStates_SummarizeForPolicyDefinition(#[from] policy_states::summarize_for_policy_definition::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForSubscriptionLevelPolicyAssignment( + #[from] policy_states::list_query_results_for_subscription_level_policy_assignment::Error, + ), + #[error(transparent)] + PolicyStates_SummarizeForSubscriptionLevelPolicyAssignment( + #[from] policy_states::summarize_for_subscription_level_policy_assignment::Error, + ), + #[error(transparent)] + PolicyStates_ListQueryResultsForResourceGroupLevelPolicyAssignment( + #[from] policy_states::list_query_results_for_resource_group_level_policy_assignment::Error, + ), + #[error(transparent)] + PolicyStates_SummarizeForResourceGroupLevelPolicyAssignment( + #[from] policy_states::summarize_for_resource_group_level_policy_assignment::Error, + ), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] PolicyMetadata_GetResource(#[from] policy_metadata::get_resource::Error), #[error(transparent)] PolicyMetadata_List(#[from] policy_metadata::list::Error), @@ -2921,6 +2990,181 @@ pub mod policy_events { skiptoken: None, } } + pub fn list_query_results_for_management_group( + &self, + policy_events_resource: impl Into, + management_groups_namespace: impl Into, + management_group_name: impl Into, + ) -> list_query_results_for_management_group::Builder { + list_query_results_for_management_group::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + management_groups_namespace: management_groups_namespace.into(), + management_group_name: management_group_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_subscription( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + ) -> list_query_results_for_subscription::Builder { + list_query_results_for_subscription::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_resource_group( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_query_results_for_resource_group::Builder { + list_query_results_for_resource_group::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_resource( + &self, + policy_events_resource: impl Into, + resource_id: impl Into, + ) -> list_query_results_for_resource::Builder { + list_query_results_for_resource::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + resource_id: resource_id.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + expand: None, + skiptoken: None, + } + } + pub fn list_query_results_for_policy_set_definition( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_set_definition_name: impl Into, + ) -> list_query_results_for_policy_set_definition::Builder { + list_query_results_for_policy_set_definition::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_set_definition_name: policy_set_definition_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_policy_definition( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_definition_name: impl Into, + ) -> list_query_results_for_policy_definition::Builder { + list_query_results_for_policy_definition::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_definition_name: policy_definition_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_subscription_level_policy_assignment( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> list_query_results_for_subscription_level_policy_assignment::Builder { + list_query_results_for_subscription_level_policy_assignment::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_resource_group_level_policy_assignment( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> list_query_results_for_resource_group_level_policy_assignment::Builder { + list_query_results_for_resource_group_level_policy_assignment::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } } pub mod next_link { use super::models; @@ -3000,20 +3244,7 @@ pub mod policy_events { } } } -} -pub mod policy_states { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn next_link(&self, next_link: impl Into) -> next_link::Builder { - next_link::Builder { - client: self.0.clone(), - next_link: next_link.into(), - skiptoken: None, - } - } - } - pub mod next_link { + pub mod list_query_results_for_management_group { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3040,17 +3271,60 @@ pub mod policy_states { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) next_link: String, + pub(crate) policy_events_resource: String, + pub(crate) management_groups_namespace: String, + pub(crate) management_group_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, pub(crate) skiptoken: Option, } impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { self.skiptoken = Some(skiptoken.into()); self } - 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!("{}{}?Next paging op for policy states", self.client.endpoint(), &self.next_link); + let url_str = &format!( + "{}/providers/{}/managementGroups/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults", + self.client.endpoint(), + &self.management_groups_namespace, + &self.management_group_name, + &self.policy_events_resource + ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::POST); @@ -3061,6 +3335,27 @@ pub mod policy_states { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } if let Some(skiptoken) = &self.skiptoken { url.query_pairs_mut().append_pair("$skiptoken", skiptoken); } @@ -3073,7 +3368,3618 @@ pub mod policy_states { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PolicyStatesQueryResults = + let rsp_value: models::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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.PolicyInsights/policyEvents/{}/queryResults", + self.client.endpoint(), + &self.subscription_id, + &self.policy_events_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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.PolicyInsights/policyEvents/{}/queryResults", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.policy_events_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) resource_id: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) expand: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults", + self.client.endpoint(), + &self.resource_id, + &self.policy_events_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_policy_set_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_set_definition_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policySetDefinitions/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_set_definition_name , & self . policy_events_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_policy_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_definition_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policyDefinitions/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_definition_name , & self . policy_events_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_subscription_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_events_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource_group_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_events_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod policy_states { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn next_link(&self, next_link: impl Into) -> next_link::Builder { + next_link::Builder { + client: self.0.clone(), + next_link: next_link.into(), + skiptoken: None, + } + } + pub fn list_query_results_for_management_group( + &self, + policy_states_resource: impl Into, + management_groups_namespace: impl Into, + management_group_name: impl Into, + ) -> list_query_results_for_management_group::Builder { + list_query_results_for_management_group::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + management_groups_namespace: management_groups_namespace.into(), + management_group_name: management_group_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_management_group( + &self, + policy_states_summary_resource: impl Into, + management_groups_namespace: impl Into, + management_group_name: impl Into, + ) -> summarize_for_management_group::Builder { + summarize_for_management_group::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + management_groups_namespace: management_groups_namespace.into(), + management_group_name: management_group_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_subscription( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + ) -> list_query_results_for_subscription::Builder { + list_query_results_for_subscription::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_subscription( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + ) -> summarize_for_subscription::Builder { + summarize_for_subscription::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_resource_group( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_query_results_for_resource_group::Builder { + list_query_results_for_resource_group::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_resource_group( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> summarize_for_resource_group::Builder { + summarize_for_resource_group::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_resource( + &self, + policy_states_resource: impl Into, + resource_id: impl Into, + ) -> list_query_results_for_resource::Builder { + list_query_results_for_resource::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + resource_id: resource_id.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + expand: None, + skiptoken: None, + } + } + pub fn summarize_for_resource( + &self, + policy_states_summary_resource: impl Into, + resource_id: impl Into, + ) -> summarize_for_resource::Builder { + summarize_for_resource::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + resource_id: resource_id.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn trigger_subscription_evaluation(&self, subscription_id: impl Into) -> trigger_subscription_evaluation::Builder { + trigger_subscription_evaluation::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn trigger_resource_group_evaluation( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> trigger_resource_group_evaluation::Builder { + trigger_resource_group_evaluation::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn list_query_results_for_policy_set_definition( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_set_definition_name: impl Into, + ) -> list_query_results_for_policy_set_definition::Builder { + list_query_results_for_policy_set_definition::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_set_definition_name: policy_set_definition_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_policy_set_definition( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_set_definition_name: impl Into, + ) -> summarize_for_policy_set_definition::Builder { + summarize_for_policy_set_definition::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_set_definition_name: policy_set_definition_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_policy_definition( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_definition_name: impl Into, + ) -> list_query_results_for_policy_definition::Builder { + list_query_results_for_policy_definition::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_definition_name: policy_definition_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_policy_definition( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_definition_name: impl Into, + ) -> summarize_for_policy_definition::Builder { + summarize_for_policy_definition::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_definition_name: policy_definition_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_subscription_level_policy_assignment( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> list_query_results_for_subscription_level_policy_assignment::Builder { + list_query_results_for_subscription_level_policy_assignment::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_subscription_level_policy_assignment( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> summarize_for_subscription_level_policy_assignment::Builder { + summarize_for_subscription_level_policy_assignment::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_resource_group_level_policy_assignment( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> list_query_results_for_resource_group_level_policy_assignment::Builder { + list_query_results_for_resource_group_level_policy_assignment::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_resource_group_level_policy_assignment( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> summarize_for_resource_group_level_policy_assignment::Builder { + summarize_for_resource_group_level_policy_assignment::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + } + pub mod next_link { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) next_link: String, + pub(crate) skiptoken: Option, + } + impl Builder { + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}{}?Next paging op for policy states", self.client.endpoint(), &self.next_link); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_management_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) management_groups_namespace: String, + pub(crate) management_group_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/{}/managementGroups/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults", + self.client.endpoint(), + &self.management_groups_namespace, + &self.management_group_name, + &self.policy_states_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_management_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) management_groups_namespace: String, + pub(crate) management_group_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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!( + "{}/providers/{}/managementGroups/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize", + self.client.endpoint(), + &self.management_groups_namespace, + &self.management_group_name, + &self.policy_states_summary_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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.PolicyInsights/policyStates/{}/queryResults", + self.client.endpoint(), + &self.subscription_id, + &self.policy_states_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize", + self.client.endpoint(), + &self.subscription_id, + &self.policy_states_summary_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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.PolicyInsights/policyStates/{}/queryResults", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.policy_states_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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.PolicyInsights/policyStates/{}/summarize", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.policy_states_summary_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) resource_id: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) expand: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults", + self.client.endpoint(), + &self.resource_id, + &self.policy_states_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_resource { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) resource_id: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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!( + "{}/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize", + self.client.endpoint(), + &self.resource_id, + &self.policy_states_summary_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_subscription_evaluation { + use super::models; + #[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::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.PolicyInsights/policyStates/latest/triggerEvaluation", + 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", "2019-10-01"); + 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::QueryFailure = + serde_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_resource_group_evaluation { + use super::models; + #[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::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, 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.PolicyInsights/policyStates/latest/triggerEvaluation", + 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::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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::QueryFailure = + serde_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_query_results_for_policy_set_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_set_definition_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policySetDefinitions/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_set_definition_name , & self . policy_states_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_policy_set_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_set_definition_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/providers/{}/policySetDefinitions/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_set_definition_name , & self . policy_states_summary_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_policy_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_definition_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policyDefinitions/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_definition_name , & self . policy_states_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_policy_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_definition_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/providers/{}/policyDefinitions/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_definition_name , & self . policy_states_summary_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_subscription_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_states_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_subscription_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/providers/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_states_summary_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource_group_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_states_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_resource_group_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_states_summary_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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; + 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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.PolicyInsights/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", "2019-10-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationsListResults = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } diff --git a/services/mgmt/policyinsights/src/package_2020_07_preview/operations.rs b/services/mgmt/policyinsights/src/package_2020_07_preview/operations.rs index 9a60ffc3a2..87debef972 100644 --- a/services/mgmt/policyinsights/src/package_2020_07_preview/operations.rs +++ b/services/mgmt/policyinsights/src/package_2020_07_preview/operations.rs @@ -74,6 +74,9 @@ impl Client { pipeline, } } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } pub fn policy_events(&self) -> policy_events::Client { policy_events::Client(self.clone()) } @@ -158,8 +161,74 @@ pub enum Error { #[error(transparent)] PolicyEvents_NextLink(#[from] policy_events::next_link::Error), #[error(transparent)] + PolicyEvents_ListQueryResultsForManagementGroup(#[from] policy_events::list_query_results_for_management_group::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForSubscription(#[from] policy_events::list_query_results_for_subscription::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForResourceGroup(#[from] policy_events::list_query_results_for_resource_group::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForResource(#[from] policy_events::list_query_results_for_resource::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForPolicySetDefinition(#[from] policy_events::list_query_results_for_policy_set_definition::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForPolicyDefinition(#[from] policy_events::list_query_results_for_policy_definition::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForSubscriptionLevelPolicyAssignment( + #[from] policy_events::list_query_results_for_subscription_level_policy_assignment::Error, + ), + #[error(transparent)] + PolicyEvents_ListQueryResultsForResourceGroupLevelPolicyAssignment( + #[from] policy_events::list_query_results_for_resource_group_level_policy_assignment::Error, + ), + #[error(transparent)] PolicyStates_NextLink(#[from] policy_states::next_link::Error), #[error(transparent)] + PolicyStates_ListQueryResultsForManagementGroup(#[from] policy_states::list_query_results_for_management_group::Error), + #[error(transparent)] + PolicyStates_SummarizeForManagementGroup(#[from] policy_states::summarize_for_management_group::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForSubscription(#[from] policy_states::list_query_results_for_subscription::Error), + #[error(transparent)] + PolicyStates_SummarizeForSubscription(#[from] policy_states::summarize_for_subscription::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForResourceGroup(#[from] policy_states::list_query_results_for_resource_group::Error), + #[error(transparent)] + PolicyStates_SummarizeForResourceGroup(#[from] policy_states::summarize_for_resource_group::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForResource(#[from] policy_states::list_query_results_for_resource::Error), + #[error(transparent)] + PolicyStates_SummarizeForResource(#[from] policy_states::summarize_for_resource::Error), + #[error(transparent)] + PolicyStates_TriggerSubscriptionEvaluation(#[from] policy_states::trigger_subscription_evaluation::Error), + #[error(transparent)] + PolicyStates_TriggerResourceGroupEvaluation(#[from] policy_states::trigger_resource_group_evaluation::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForPolicySetDefinition(#[from] policy_states::list_query_results_for_policy_set_definition::Error), + #[error(transparent)] + PolicyStates_SummarizeForPolicySetDefinition(#[from] policy_states::summarize_for_policy_set_definition::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForPolicyDefinition(#[from] policy_states::list_query_results_for_policy_definition::Error), + #[error(transparent)] + PolicyStates_SummarizeForPolicyDefinition(#[from] policy_states::summarize_for_policy_definition::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForSubscriptionLevelPolicyAssignment( + #[from] policy_states::list_query_results_for_subscription_level_policy_assignment::Error, + ), + #[error(transparent)] + PolicyStates_SummarizeForSubscriptionLevelPolicyAssignment( + #[from] policy_states::summarize_for_subscription_level_policy_assignment::Error, + ), + #[error(transparent)] + PolicyStates_ListQueryResultsForResourceGroupLevelPolicyAssignment( + #[from] policy_states::list_query_results_for_resource_group_level_policy_assignment::Error, + ), + #[error(transparent)] + PolicyStates_SummarizeForResourceGroupLevelPolicyAssignment( + #[from] policy_states::summarize_for_resource_group_level_policy_assignment::Error, + ), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] PolicyMetadata_GetResource(#[from] policy_metadata::get_resource::Error), #[error(transparent)] PolicyMetadata_List(#[from] policy_metadata::list::Error), @@ -2921,6 +2990,181 @@ pub mod policy_events { skiptoken: None, } } + pub fn list_query_results_for_management_group( + &self, + policy_events_resource: impl Into, + management_groups_namespace: impl Into, + management_group_name: impl Into, + ) -> list_query_results_for_management_group::Builder { + list_query_results_for_management_group::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + management_groups_namespace: management_groups_namespace.into(), + management_group_name: management_group_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_subscription( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + ) -> list_query_results_for_subscription::Builder { + list_query_results_for_subscription::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_resource_group( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_query_results_for_resource_group::Builder { + list_query_results_for_resource_group::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_resource( + &self, + policy_events_resource: impl Into, + resource_id: impl Into, + ) -> list_query_results_for_resource::Builder { + list_query_results_for_resource::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + resource_id: resource_id.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + expand: None, + skiptoken: None, + } + } + pub fn list_query_results_for_policy_set_definition( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_set_definition_name: impl Into, + ) -> list_query_results_for_policy_set_definition::Builder { + list_query_results_for_policy_set_definition::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_set_definition_name: policy_set_definition_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_policy_definition( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_definition_name: impl Into, + ) -> list_query_results_for_policy_definition::Builder { + list_query_results_for_policy_definition::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_definition_name: policy_definition_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_subscription_level_policy_assignment( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> list_query_results_for_subscription_level_policy_assignment::Builder { + list_query_results_for_subscription_level_policy_assignment::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_resource_group_level_policy_assignment( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> list_query_results_for_resource_group_level_policy_assignment::Builder { + list_query_results_for_resource_group_level_policy_assignment::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } } pub mod next_link { use super::models; @@ -3000,20 +3244,7 @@ pub mod policy_events { } } } -} -pub mod policy_states { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn next_link(&self, next_link: impl Into) -> next_link::Builder { - next_link::Builder { - client: self.0.clone(), - next_link: next_link.into(), - skiptoken: None, - } - } - } - pub mod next_link { + pub mod list_query_results_for_management_group { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3040,17 +3271,60 @@ pub mod policy_states { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) next_link: String, + pub(crate) policy_events_resource: String, + pub(crate) management_groups_namespace: String, + pub(crate) management_group_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, pub(crate) skiptoken: Option, } impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { self.skiptoken = Some(skiptoken.into()); self } - 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!("{}{}?Next paging op for policy states", self.client.endpoint(), &self.next_link); + let url_str = &format!( + "{}/providers/{}/managementGroups/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults", + self.client.endpoint(), + &self.management_groups_namespace, + &self.management_group_name, + &self.policy_events_resource + ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::POST); @@ -3061,6 +3335,27 @@ pub mod policy_states { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } if let Some(skiptoken) = &self.skiptoken { url.query_pairs_mut().append_pair("$skiptoken", skiptoken); } @@ -3073,7 +3368,3618 @@ pub mod policy_states { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PolicyStatesQueryResults = + let rsp_value: models::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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.PolicyInsights/policyEvents/{}/queryResults", + self.client.endpoint(), + &self.subscription_id, + &self.policy_events_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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.PolicyInsights/policyEvents/{}/queryResults", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.policy_events_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) resource_id: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) expand: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults", + self.client.endpoint(), + &self.resource_id, + &self.policy_events_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_policy_set_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_set_definition_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policySetDefinitions/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_set_definition_name , & self . policy_events_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_policy_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_definition_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policyDefinitions/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_definition_name , & self . policy_events_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_subscription_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_events_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource_group_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_events_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod policy_states { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn next_link(&self, next_link: impl Into) -> next_link::Builder { + next_link::Builder { + client: self.0.clone(), + next_link: next_link.into(), + skiptoken: None, + } + } + pub fn list_query_results_for_management_group( + &self, + policy_states_resource: impl Into, + management_groups_namespace: impl Into, + management_group_name: impl Into, + ) -> list_query_results_for_management_group::Builder { + list_query_results_for_management_group::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + management_groups_namespace: management_groups_namespace.into(), + management_group_name: management_group_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_management_group( + &self, + policy_states_summary_resource: impl Into, + management_groups_namespace: impl Into, + management_group_name: impl Into, + ) -> summarize_for_management_group::Builder { + summarize_for_management_group::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + management_groups_namespace: management_groups_namespace.into(), + management_group_name: management_group_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_subscription( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + ) -> list_query_results_for_subscription::Builder { + list_query_results_for_subscription::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_subscription( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + ) -> summarize_for_subscription::Builder { + summarize_for_subscription::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_resource_group( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_query_results_for_resource_group::Builder { + list_query_results_for_resource_group::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_resource_group( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> summarize_for_resource_group::Builder { + summarize_for_resource_group::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_resource( + &self, + policy_states_resource: impl Into, + resource_id: impl Into, + ) -> list_query_results_for_resource::Builder { + list_query_results_for_resource::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + resource_id: resource_id.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + expand: None, + skiptoken: None, + } + } + pub fn summarize_for_resource( + &self, + policy_states_summary_resource: impl Into, + resource_id: impl Into, + ) -> summarize_for_resource::Builder { + summarize_for_resource::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + resource_id: resource_id.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn trigger_subscription_evaluation(&self, subscription_id: impl Into) -> trigger_subscription_evaluation::Builder { + trigger_subscription_evaluation::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn trigger_resource_group_evaluation( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> trigger_resource_group_evaluation::Builder { + trigger_resource_group_evaluation::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn list_query_results_for_policy_set_definition( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_set_definition_name: impl Into, + ) -> list_query_results_for_policy_set_definition::Builder { + list_query_results_for_policy_set_definition::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_set_definition_name: policy_set_definition_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_policy_set_definition( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_set_definition_name: impl Into, + ) -> summarize_for_policy_set_definition::Builder { + summarize_for_policy_set_definition::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_set_definition_name: policy_set_definition_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_policy_definition( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_definition_name: impl Into, + ) -> list_query_results_for_policy_definition::Builder { + list_query_results_for_policy_definition::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_definition_name: policy_definition_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_policy_definition( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_definition_name: impl Into, + ) -> summarize_for_policy_definition::Builder { + summarize_for_policy_definition::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_definition_name: policy_definition_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_subscription_level_policy_assignment( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> list_query_results_for_subscription_level_policy_assignment::Builder { + list_query_results_for_subscription_level_policy_assignment::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_subscription_level_policy_assignment( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> summarize_for_subscription_level_policy_assignment::Builder { + summarize_for_subscription_level_policy_assignment::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_resource_group_level_policy_assignment( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> list_query_results_for_resource_group_level_policy_assignment::Builder { + list_query_results_for_resource_group_level_policy_assignment::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_resource_group_level_policy_assignment( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> summarize_for_resource_group_level_policy_assignment::Builder { + summarize_for_resource_group_level_policy_assignment::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + } + pub mod next_link { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) next_link: String, + pub(crate) skiptoken: Option, + } + impl Builder { + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}{}?Next paging op for policy states", self.client.endpoint(), &self.next_link); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_management_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) management_groups_namespace: String, + pub(crate) management_group_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/{}/managementGroups/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults", + self.client.endpoint(), + &self.management_groups_namespace, + &self.management_group_name, + &self.policy_states_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_management_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) management_groups_namespace: String, + pub(crate) management_group_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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!( + "{}/providers/{}/managementGroups/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize", + self.client.endpoint(), + &self.management_groups_namespace, + &self.management_group_name, + &self.policy_states_summary_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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.PolicyInsights/policyStates/{}/queryResults", + self.client.endpoint(), + &self.subscription_id, + &self.policy_states_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize", + self.client.endpoint(), + &self.subscription_id, + &self.policy_states_summary_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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.PolicyInsights/policyStates/{}/queryResults", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.policy_states_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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.PolicyInsights/policyStates/{}/summarize", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.policy_states_summary_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) resource_id: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) expand: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults", + self.client.endpoint(), + &self.resource_id, + &self.policy_states_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_resource { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) resource_id: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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!( + "{}/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize", + self.client.endpoint(), + &self.resource_id, + &self.policy_states_summary_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_subscription_evaluation { + use super::models; + #[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::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.PolicyInsights/policyStates/latest/triggerEvaluation", + 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", "2019-10-01"); + 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::QueryFailure = + serde_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_resource_group_evaluation { + use super::models; + #[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::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, 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.PolicyInsights/policyStates/latest/triggerEvaluation", + 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::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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::QueryFailure = + serde_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_query_results_for_policy_set_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_set_definition_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policySetDefinitions/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_set_definition_name , & self . policy_states_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_policy_set_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_set_definition_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/providers/{}/policySetDefinitions/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_set_definition_name , & self . policy_states_summary_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_policy_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_definition_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policyDefinitions/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_definition_name , & self . policy_states_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_policy_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_definition_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/providers/{}/policyDefinitions/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_definition_name , & self . policy_states_summary_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_subscription_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_states_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_subscription_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/providers/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_states_summary_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource_group_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_states_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_resource_group_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_states_summary_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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; + 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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.PolicyInsights/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", "2019-10-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationsListResults = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } diff --git a/services/mgmt/policyinsights/src/package_2021_01/operations.rs b/services/mgmt/policyinsights/src/package_2021_01/operations.rs index 69e517324a..64eebf05b5 100644 --- a/services/mgmt/policyinsights/src/package_2021_01/operations.rs +++ b/services/mgmt/policyinsights/src/package_2021_01/operations.rs @@ -77,6 +77,9 @@ impl Client { pub fn attestations(&self) -> attestations::Client { attestations::Client(self.clone()) } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } pub fn policy_events(&self) -> policy_events::Client { policy_events::Client(self.clone()) } @@ -161,8 +164,74 @@ pub enum Error { #[error(transparent)] PolicyEvents_NextLink(#[from] policy_events::next_link::Error), #[error(transparent)] + PolicyEvents_ListQueryResultsForManagementGroup(#[from] policy_events::list_query_results_for_management_group::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForSubscription(#[from] policy_events::list_query_results_for_subscription::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForResourceGroup(#[from] policy_events::list_query_results_for_resource_group::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForResource(#[from] policy_events::list_query_results_for_resource::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForPolicySetDefinition(#[from] policy_events::list_query_results_for_policy_set_definition::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForPolicyDefinition(#[from] policy_events::list_query_results_for_policy_definition::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForSubscriptionLevelPolicyAssignment( + #[from] policy_events::list_query_results_for_subscription_level_policy_assignment::Error, + ), + #[error(transparent)] + PolicyEvents_ListQueryResultsForResourceGroupLevelPolicyAssignment( + #[from] policy_events::list_query_results_for_resource_group_level_policy_assignment::Error, + ), + #[error(transparent)] PolicyStates_NextLink(#[from] policy_states::next_link::Error), #[error(transparent)] + PolicyStates_ListQueryResultsForManagementGroup(#[from] policy_states::list_query_results_for_management_group::Error), + #[error(transparent)] + PolicyStates_SummarizeForManagementGroup(#[from] policy_states::summarize_for_management_group::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForSubscription(#[from] policy_states::list_query_results_for_subscription::Error), + #[error(transparent)] + PolicyStates_SummarizeForSubscription(#[from] policy_states::summarize_for_subscription::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForResourceGroup(#[from] policy_states::list_query_results_for_resource_group::Error), + #[error(transparent)] + PolicyStates_SummarizeForResourceGroup(#[from] policy_states::summarize_for_resource_group::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForResource(#[from] policy_states::list_query_results_for_resource::Error), + #[error(transparent)] + PolicyStates_SummarizeForResource(#[from] policy_states::summarize_for_resource::Error), + #[error(transparent)] + PolicyStates_TriggerSubscriptionEvaluation(#[from] policy_states::trigger_subscription_evaluation::Error), + #[error(transparent)] + PolicyStates_TriggerResourceGroupEvaluation(#[from] policy_states::trigger_resource_group_evaluation::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForPolicySetDefinition(#[from] policy_states::list_query_results_for_policy_set_definition::Error), + #[error(transparent)] + PolicyStates_SummarizeForPolicySetDefinition(#[from] policy_states::summarize_for_policy_set_definition::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForPolicyDefinition(#[from] policy_states::list_query_results_for_policy_definition::Error), + #[error(transparent)] + PolicyStates_SummarizeForPolicyDefinition(#[from] policy_states::summarize_for_policy_definition::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForSubscriptionLevelPolicyAssignment( + #[from] policy_states::list_query_results_for_subscription_level_policy_assignment::Error, + ), + #[error(transparent)] + PolicyStates_SummarizeForSubscriptionLevelPolicyAssignment( + #[from] policy_states::summarize_for_subscription_level_policy_assignment::Error, + ), + #[error(transparent)] + PolicyStates_ListQueryResultsForResourceGroupLevelPolicyAssignment( + #[from] policy_states::list_query_results_for_resource_group_level_policy_assignment::Error, + ), + #[error(transparent)] + PolicyStates_SummarizeForResourceGroupLevelPolicyAssignment( + #[from] policy_states::summarize_for_resource_group_level_policy_assignment::Error, + ), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] PolicyMetadata_GetResource(#[from] policy_metadata::get_resource::Error), #[error(transparent)] PolicyMetadata_List(#[from] policy_metadata::list::Error), @@ -2948,6 +3017,181 @@ pub mod policy_events { skiptoken: None, } } + pub fn list_query_results_for_management_group( + &self, + policy_events_resource: impl Into, + management_groups_namespace: impl Into, + management_group_name: impl Into, + ) -> list_query_results_for_management_group::Builder { + list_query_results_for_management_group::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + management_groups_namespace: management_groups_namespace.into(), + management_group_name: management_group_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_subscription( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + ) -> list_query_results_for_subscription::Builder { + list_query_results_for_subscription::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_resource_group( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_query_results_for_resource_group::Builder { + list_query_results_for_resource_group::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_resource( + &self, + policy_events_resource: impl Into, + resource_id: impl Into, + ) -> list_query_results_for_resource::Builder { + list_query_results_for_resource::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + resource_id: resource_id.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + expand: None, + skiptoken: None, + } + } + pub fn list_query_results_for_policy_set_definition( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_set_definition_name: impl Into, + ) -> list_query_results_for_policy_set_definition::Builder { + list_query_results_for_policy_set_definition::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_set_definition_name: policy_set_definition_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_policy_definition( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_definition_name: impl Into, + ) -> list_query_results_for_policy_definition::Builder { + list_query_results_for_policy_definition::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_definition_name: policy_definition_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_subscription_level_policy_assignment( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> list_query_results_for_subscription_level_policy_assignment::Builder { + list_query_results_for_subscription_level_policy_assignment::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_resource_group_level_policy_assignment( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> list_query_results_for_resource_group_level_policy_assignment::Builder { + list_query_results_for_resource_group_level_policy_assignment::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } } pub mod next_link { use super::models; @@ -3027,20 +3271,7 @@ pub mod policy_events { } } } -} -pub mod policy_states { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn next_link(&self, next_link: impl Into) -> next_link::Builder { - next_link::Builder { - client: self.0.clone(), - next_link: next_link.into(), - skiptoken: None, - } - } - } - pub mod next_link { + pub mod list_query_results_for_management_group { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3067,17 +3298,60 @@ pub mod policy_states { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) next_link: String, + pub(crate) policy_events_resource: String, + pub(crate) management_groups_namespace: String, + pub(crate) management_group_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, pub(crate) skiptoken: Option, } impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { self.skiptoken = Some(skiptoken.into()); self } - 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!("{}{}?Next paging op for policy states", self.client.endpoint(), &self.next_link); + let url_str = &format!( + "{}/providers/{}/managementGroups/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults", + self.client.endpoint(), + &self.management_groups_namespace, + &self.management_group_name, + &self.policy_events_resource + ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::POST); @@ -3088,6 +3362,27 @@ pub mod policy_states { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } if let Some(skiptoken) = &self.skiptoken { url.query_pairs_mut().append_pair("$skiptoken", skiptoken); } @@ -3100,7 +3395,3618 @@ pub mod policy_states { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PolicyStatesQueryResults = + let rsp_value: models::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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.PolicyInsights/policyEvents/{}/queryResults", + self.client.endpoint(), + &self.subscription_id, + &self.policy_events_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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.PolicyInsights/policyEvents/{}/queryResults", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.policy_events_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) resource_id: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) expand: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults", + self.client.endpoint(), + &self.resource_id, + &self.policy_events_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_policy_set_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_set_definition_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policySetDefinitions/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_set_definition_name , & self . policy_events_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_policy_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_definition_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policyDefinitions/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_definition_name , & self . policy_events_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_subscription_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_events_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource_group_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_events_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod policy_states { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn next_link(&self, next_link: impl Into) -> next_link::Builder { + next_link::Builder { + client: self.0.clone(), + next_link: next_link.into(), + skiptoken: None, + } + } + pub fn list_query_results_for_management_group( + &self, + policy_states_resource: impl Into, + management_groups_namespace: impl Into, + management_group_name: impl Into, + ) -> list_query_results_for_management_group::Builder { + list_query_results_for_management_group::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + management_groups_namespace: management_groups_namespace.into(), + management_group_name: management_group_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_management_group( + &self, + policy_states_summary_resource: impl Into, + management_groups_namespace: impl Into, + management_group_name: impl Into, + ) -> summarize_for_management_group::Builder { + summarize_for_management_group::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + management_groups_namespace: management_groups_namespace.into(), + management_group_name: management_group_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_subscription( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + ) -> list_query_results_for_subscription::Builder { + list_query_results_for_subscription::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_subscription( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + ) -> summarize_for_subscription::Builder { + summarize_for_subscription::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_resource_group( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_query_results_for_resource_group::Builder { + list_query_results_for_resource_group::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_resource_group( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> summarize_for_resource_group::Builder { + summarize_for_resource_group::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_resource( + &self, + policy_states_resource: impl Into, + resource_id: impl Into, + ) -> list_query_results_for_resource::Builder { + list_query_results_for_resource::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + resource_id: resource_id.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + expand: None, + skiptoken: None, + } + } + pub fn summarize_for_resource( + &self, + policy_states_summary_resource: impl Into, + resource_id: impl Into, + ) -> summarize_for_resource::Builder { + summarize_for_resource::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + resource_id: resource_id.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn trigger_subscription_evaluation(&self, subscription_id: impl Into) -> trigger_subscription_evaluation::Builder { + trigger_subscription_evaluation::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn trigger_resource_group_evaluation( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> trigger_resource_group_evaluation::Builder { + trigger_resource_group_evaluation::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn list_query_results_for_policy_set_definition( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_set_definition_name: impl Into, + ) -> list_query_results_for_policy_set_definition::Builder { + list_query_results_for_policy_set_definition::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_set_definition_name: policy_set_definition_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_policy_set_definition( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_set_definition_name: impl Into, + ) -> summarize_for_policy_set_definition::Builder { + summarize_for_policy_set_definition::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_set_definition_name: policy_set_definition_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_policy_definition( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_definition_name: impl Into, + ) -> list_query_results_for_policy_definition::Builder { + list_query_results_for_policy_definition::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_definition_name: policy_definition_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_policy_definition( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_definition_name: impl Into, + ) -> summarize_for_policy_definition::Builder { + summarize_for_policy_definition::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_definition_name: policy_definition_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_subscription_level_policy_assignment( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> list_query_results_for_subscription_level_policy_assignment::Builder { + list_query_results_for_subscription_level_policy_assignment::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_subscription_level_policy_assignment( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> summarize_for_subscription_level_policy_assignment::Builder { + summarize_for_subscription_level_policy_assignment::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_resource_group_level_policy_assignment( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> list_query_results_for_resource_group_level_policy_assignment::Builder { + list_query_results_for_resource_group_level_policy_assignment::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_resource_group_level_policy_assignment( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> summarize_for_resource_group_level_policy_assignment::Builder { + summarize_for_resource_group_level_policy_assignment::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + } + pub mod next_link { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) next_link: String, + pub(crate) skiptoken: Option, + } + impl Builder { + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}{}?Next paging op for policy states", self.client.endpoint(), &self.next_link); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_management_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) management_groups_namespace: String, + pub(crate) management_group_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/{}/managementGroups/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults", + self.client.endpoint(), + &self.management_groups_namespace, + &self.management_group_name, + &self.policy_states_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_management_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) management_groups_namespace: String, + pub(crate) management_group_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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!( + "{}/providers/{}/managementGroups/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize", + self.client.endpoint(), + &self.management_groups_namespace, + &self.management_group_name, + &self.policy_states_summary_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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.PolicyInsights/policyStates/{}/queryResults", + self.client.endpoint(), + &self.subscription_id, + &self.policy_states_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize", + self.client.endpoint(), + &self.subscription_id, + &self.policy_states_summary_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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.PolicyInsights/policyStates/{}/queryResults", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.policy_states_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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.PolicyInsights/policyStates/{}/summarize", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.policy_states_summary_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) resource_id: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) expand: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults", + self.client.endpoint(), + &self.resource_id, + &self.policy_states_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_resource { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) resource_id: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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!( + "{}/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize", + self.client.endpoint(), + &self.resource_id, + &self.policy_states_summary_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_subscription_evaluation { + use super::models; + #[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::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.PolicyInsights/policyStates/latest/triggerEvaluation", + 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", "2019-10-01"); + 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::QueryFailure = + serde_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_resource_group_evaluation { + use super::models; + #[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::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, 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.PolicyInsights/policyStates/latest/triggerEvaluation", + 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::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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::QueryFailure = + serde_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_query_results_for_policy_set_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_set_definition_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policySetDefinitions/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_set_definition_name , & self . policy_states_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_policy_set_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_set_definition_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/providers/{}/policySetDefinitions/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_set_definition_name , & self . policy_states_summary_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_policy_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_definition_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policyDefinitions/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_definition_name , & self . policy_states_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_policy_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_definition_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/providers/{}/policyDefinitions/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_definition_name , & self . policy_states_summary_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_subscription_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_states_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_subscription_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/providers/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_states_summary_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource_group_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_states_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_resource_group_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_states_summary_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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; + 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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.PolicyInsights/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", "2019-10-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationsListResults = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } diff --git a/services/mgmt/policyinsights/src/package_2021_10/operations.rs b/services/mgmt/policyinsights/src/package_2021_10/operations.rs index 5e8956d58a..13cb967fbf 100644 --- a/services/mgmt/policyinsights/src/package_2021_10/operations.rs +++ b/services/mgmt/policyinsights/src/package_2021_10/operations.rs @@ -77,6 +77,9 @@ impl Client { pub fn attestations(&self) -> attestations::Client { attestations::Client(self.clone()) } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } pub fn policy_events(&self) -> policy_events::Client { policy_events::Client(self.clone()) } @@ -161,8 +164,74 @@ pub enum Error { #[error(transparent)] PolicyEvents_NextLink(#[from] policy_events::next_link::Error), #[error(transparent)] + PolicyEvents_ListQueryResultsForManagementGroup(#[from] policy_events::list_query_results_for_management_group::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForSubscription(#[from] policy_events::list_query_results_for_subscription::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForResourceGroup(#[from] policy_events::list_query_results_for_resource_group::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForResource(#[from] policy_events::list_query_results_for_resource::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForPolicySetDefinition(#[from] policy_events::list_query_results_for_policy_set_definition::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForPolicyDefinition(#[from] policy_events::list_query_results_for_policy_definition::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForSubscriptionLevelPolicyAssignment( + #[from] policy_events::list_query_results_for_subscription_level_policy_assignment::Error, + ), + #[error(transparent)] + PolicyEvents_ListQueryResultsForResourceGroupLevelPolicyAssignment( + #[from] policy_events::list_query_results_for_resource_group_level_policy_assignment::Error, + ), + #[error(transparent)] PolicyStates_NextLink(#[from] policy_states::next_link::Error), #[error(transparent)] + PolicyStates_ListQueryResultsForManagementGroup(#[from] policy_states::list_query_results_for_management_group::Error), + #[error(transparent)] + PolicyStates_SummarizeForManagementGroup(#[from] policy_states::summarize_for_management_group::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForSubscription(#[from] policy_states::list_query_results_for_subscription::Error), + #[error(transparent)] + PolicyStates_SummarizeForSubscription(#[from] policy_states::summarize_for_subscription::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForResourceGroup(#[from] policy_states::list_query_results_for_resource_group::Error), + #[error(transparent)] + PolicyStates_SummarizeForResourceGroup(#[from] policy_states::summarize_for_resource_group::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForResource(#[from] policy_states::list_query_results_for_resource::Error), + #[error(transparent)] + PolicyStates_SummarizeForResource(#[from] policy_states::summarize_for_resource::Error), + #[error(transparent)] + PolicyStates_TriggerSubscriptionEvaluation(#[from] policy_states::trigger_subscription_evaluation::Error), + #[error(transparent)] + PolicyStates_TriggerResourceGroupEvaluation(#[from] policy_states::trigger_resource_group_evaluation::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForPolicySetDefinition(#[from] policy_states::list_query_results_for_policy_set_definition::Error), + #[error(transparent)] + PolicyStates_SummarizeForPolicySetDefinition(#[from] policy_states::summarize_for_policy_set_definition::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForPolicyDefinition(#[from] policy_states::list_query_results_for_policy_definition::Error), + #[error(transparent)] + PolicyStates_SummarizeForPolicyDefinition(#[from] policy_states::summarize_for_policy_definition::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForSubscriptionLevelPolicyAssignment( + #[from] policy_states::list_query_results_for_subscription_level_policy_assignment::Error, + ), + #[error(transparent)] + PolicyStates_SummarizeForSubscriptionLevelPolicyAssignment( + #[from] policy_states::summarize_for_subscription_level_policy_assignment::Error, + ), + #[error(transparent)] + PolicyStates_ListQueryResultsForResourceGroupLevelPolicyAssignment( + #[from] policy_states::list_query_results_for_resource_group_level_policy_assignment::Error, + ), + #[error(transparent)] + PolicyStates_SummarizeForResourceGroupLevelPolicyAssignment( + #[from] policy_states::summarize_for_resource_group_level_policy_assignment::Error, + ), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] PolicyMetadata_GetResource(#[from] policy_metadata::get_resource::Error), #[error(transparent)] PolicyMetadata_List(#[from] policy_metadata::list::Error), @@ -2948,6 +3017,181 @@ pub mod policy_events { skiptoken: None, } } + pub fn list_query_results_for_management_group( + &self, + policy_events_resource: impl Into, + management_groups_namespace: impl Into, + management_group_name: impl Into, + ) -> list_query_results_for_management_group::Builder { + list_query_results_for_management_group::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + management_groups_namespace: management_groups_namespace.into(), + management_group_name: management_group_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_subscription( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + ) -> list_query_results_for_subscription::Builder { + list_query_results_for_subscription::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_resource_group( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_query_results_for_resource_group::Builder { + list_query_results_for_resource_group::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_resource( + &self, + policy_events_resource: impl Into, + resource_id: impl Into, + ) -> list_query_results_for_resource::Builder { + list_query_results_for_resource::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + resource_id: resource_id.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + expand: None, + skiptoken: None, + } + } + pub fn list_query_results_for_policy_set_definition( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_set_definition_name: impl Into, + ) -> list_query_results_for_policy_set_definition::Builder { + list_query_results_for_policy_set_definition::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_set_definition_name: policy_set_definition_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_policy_definition( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_definition_name: impl Into, + ) -> list_query_results_for_policy_definition::Builder { + list_query_results_for_policy_definition::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_definition_name: policy_definition_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_subscription_level_policy_assignment( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> list_query_results_for_subscription_level_policy_assignment::Builder { + list_query_results_for_subscription_level_policy_assignment::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_resource_group_level_policy_assignment( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> list_query_results_for_resource_group_level_policy_assignment::Builder { + list_query_results_for_resource_group_level_policy_assignment::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } } pub mod next_link { use super::models; @@ -3027,20 +3271,7 @@ pub mod policy_events { } } } -} -pub mod policy_states { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn next_link(&self, next_link: impl Into) -> next_link::Builder { - next_link::Builder { - client: self.0.clone(), - next_link: next_link.into(), - skiptoken: None, - } - } - } - pub mod next_link { + pub mod list_query_results_for_management_group { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3067,17 +3298,60 @@ pub mod policy_states { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) next_link: String, + pub(crate) policy_events_resource: String, + pub(crate) management_groups_namespace: String, + pub(crate) management_group_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, pub(crate) skiptoken: Option, } impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { self.skiptoken = Some(skiptoken.into()); self } - 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!("{}{}?Next paging op for policy states", self.client.endpoint(), &self.next_link); + let url_str = &format!( + "{}/providers/{}/managementGroups/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults", + self.client.endpoint(), + &self.management_groups_namespace, + &self.management_group_name, + &self.policy_events_resource + ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::POST); @@ -3088,6 +3362,27 @@ pub mod policy_states { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } if let Some(skiptoken) = &self.skiptoken { url.query_pairs_mut().append_pair("$skiptoken", skiptoken); } @@ -3100,7 +3395,3618 @@ pub mod policy_states { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PolicyStatesQueryResults = + let rsp_value: models::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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.PolicyInsights/policyEvents/{}/queryResults", + self.client.endpoint(), + &self.subscription_id, + &self.policy_events_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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.PolicyInsights/policyEvents/{}/queryResults", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.policy_events_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) resource_id: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) expand: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults", + self.client.endpoint(), + &self.resource_id, + &self.policy_events_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_policy_set_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_set_definition_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policySetDefinitions/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_set_definition_name , & self . policy_events_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_policy_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_definition_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policyDefinitions/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_definition_name , & self . policy_events_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_subscription_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_events_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource_group_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_events_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod policy_states { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn next_link(&self, next_link: impl Into) -> next_link::Builder { + next_link::Builder { + client: self.0.clone(), + next_link: next_link.into(), + skiptoken: None, + } + } + pub fn list_query_results_for_management_group( + &self, + policy_states_resource: impl Into, + management_groups_namespace: impl Into, + management_group_name: impl Into, + ) -> list_query_results_for_management_group::Builder { + list_query_results_for_management_group::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + management_groups_namespace: management_groups_namespace.into(), + management_group_name: management_group_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_management_group( + &self, + policy_states_summary_resource: impl Into, + management_groups_namespace: impl Into, + management_group_name: impl Into, + ) -> summarize_for_management_group::Builder { + summarize_for_management_group::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + management_groups_namespace: management_groups_namespace.into(), + management_group_name: management_group_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_subscription( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + ) -> list_query_results_for_subscription::Builder { + list_query_results_for_subscription::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_subscription( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + ) -> summarize_for_subscription::Builder { + summarize_for_subscription::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_resource_group( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_query_results_for_resource_group::Builder { + list_query_results_for_resource_group::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_resource_group( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> summarize_for_resource_group::Builder { + summarize_for_resource_group::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_resource( + &self, + policy_states_resource: impl Into, + resource_id: impl Into, + ) -> list_query_results_for_resource::Builder { + list_query_results_for_resource::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + resource_id: resource_id.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + expand: None, + skiptoken: None, + } + } + pub fn summarize_for_resource( + &self, + policy_states_summary_resource: impl Into, + resource_id: impl Into, + ) -> summarize_for_resource::Builder { + summarize_for_resource::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + resource_id: resource_id.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn trigger_subscription_evaluation(&self, subscription_id: impl Into) -> trigger_subscription_evaluation::Builder { + trigger_subscription_evaluation::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn trigger_resource_group_evaluation( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> trigger_resource_group_evaluation::Builder { + trigger_resource_group_evaluation::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn list_query_results_for_policy_set_definition( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_set_definition_name: impl Into, + ) -> list_query_results_for_policy_set_definition::Builder { + list_query_results_for_policy_set_definition::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_set_definition_name: policy_set_definition_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_policy_set_definition( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_set_definition_name: impl Into, + ) -> summarize_for_policy_set_definition::Builder { + summarize_for_policy_set_definition::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_set_definition_name: policy_set_definition_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_policy_definition( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_definition_name: impl Into, + ) -> list_query_results_for_policy_definition::Builder { + list_query_results_for_policy_definition::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_definition_name: policy_definition_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_policy_definition( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_definition_name: impl Into, + ) -> summarize_for_policy_definition::Builder { + summarize_for_policy_definition::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_definition_name: policy_definition_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_subscription_level_policy_assignment( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> list_query_results_for_subscription_level_policy_assignment::Builder { + list_query_results_for_subscription_level_policy_assignment::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_subscription_level_policy_assignment( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> summarize_for_subscription_level_policy_assignment::Builder { + summarize_for_subscription_level_policy_assignment::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_resource_group_level_policy_assignment( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> list_query_results_for_resource_group_level_policy_assignment::Builder { + list_query_results_for_resource_group_level_policy_assignment::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_resource_group_level_policy_assignment( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> summarize_for_resource_group_level_policy_assignment::Builder { + summarize_for_resource_group_level_policy_assignment::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + } + pub mod next_link { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) next_link: String, + pub(crate) skiptoken: Option, + } + impl Builder { + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}{}?Next paging op for policy states", self.client.endpoint(), &self.next_link); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_management_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) management_groups_namespace: String, + pub(crate) management_group_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/{}/managementGroups/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults", + self.client.endpoint(), + &self.management_groups_namespace, + &self.management_group_name, + &self.policy_states_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_management_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) management_groups_namespace: String, + pub(crate) management_group_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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!( + "{}/providers/{}/managementGroups/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize", + self.client.endpoint(), + &self.management_groups_namespace, + &self.management_group_name, + &self.policy_states_summary_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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.PolicyInsights/policyStates/{}/queryResults", + self.client.endpoint(), + &self.subscription_id, + &self.policy_states_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize", + self.client.endpoint(), + &self.subscription_id, + &self.policy_states_summary_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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.PolicyInsights/policyStates/{}/queryResults", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.policy_states_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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.PolicyInsights/policyStates/{}/summarize", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.policy_states_summary_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) resource_id: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) expand: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults", + self.client.endpoint(), + &self.resource_id, + &self.policy_states_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_resource { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) resource_id: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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!( + "{}/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize", + self.client.endpoint(), + &self.resource_id, + &self.policy_states_summary_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_subscription_evaluation { + use super::models; + #[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::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.PolicyInsights/policyStates/latest/triggerEvaluation", + 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", "2019-10-01"); + 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::QueryFailure = + serde_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_resource_group_evaluation { + use super::models; + #[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::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, 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.PolicyInsights/policyStates/latest/triggerEvaluation", + 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::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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::QueryFailure = + serde_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_query_results_for_policy_set_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_set_definition_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policySetDefinitions/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_set_definition_name , & self . policy_states_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_policy_set_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_set_definition_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/providers/{}/policySetDefinitions/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_set_definition_name , & self . policy_states_summary_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_policy_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_definition_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policyDefinitions/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_definition_name , & self . policy_states_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_policy_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_definition_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/providers/{}/policyDefinitions/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_definition_name , & self . policy_states_summary_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_subscription_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_states_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_subscription_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/providers/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_states_summary_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource_group_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_states_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_resource_group_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_states_summary_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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; + 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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.PolicyInsights/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", "2019-10-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationsListResults = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } diff --git a/services/mgmt/policyinsights/src/package_2022_03/operations.rs b/services/mgmt/policyinsights/src/package_2022_03/operations.rs index 8f7a384e93..392bcc5635 100644 --- a/services/mgmt/policyinsights/src/package_2022_03/operations.rs +++ b/services/mgmt/policyinsights/src/package_2022_03/operations.rs @@ -77,6 +77,9 @@ impl Client { pub fn attestations(&self) -> attestations::Client { attestations::Client(self.clone()) } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } pub fn policy_events(&self) -> policy_events::Client { policy_events::Client(self.clone()) } @@ -161,8 +164,74 @@ pub enum Error { #[error(transparent)] PolicyEvents_NextLink(#[from] policy_events::next_link::Error), #[error(transparent)] + PolicyEvents_ListQueryResultsForManagementGroup(#[from] policy_events::list_query_results_for_management_group::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForSubscription(#[from] policy_events::list_query_results_for_subscription::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForResourceGroup(#[from] policy_events::list_query_results_for_resource_group::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForResource(#[from] policy_events::list_query_results_for_resource::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForPolicySetDefinition(#[from] policy_events::list_query_results_for_policy_set_definition::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForPolicyDefinition(#[from] policy_events::list_query_results_for_policy_definition::Error), + #[error(transparent)] + PolicyEvents_ListQueryResultsForSubscriptionLevelPolicyAssignment( + #[from] policy_events::list_query_results_for_subscription_level_policy_assignment::Error, + ), + #[error(transparent)] + PolicyEvents_ListQueryResultsForResourceGroupLevelPolicyAssignment( + #[from] policy_events::list_query_results_for_resource_group_level_policy_assignment::Error, + ), + #[error(transparent)] PolicyStates_NextLink(#[from] policy_states::next_link::Error), #[error(transparent)] + PolicyStates_ListQueryResultsForManagementGroup(#[from] policy_states::list_query_results_for_management_group::Error), + #[error(transparent)] + PolicyStates_SummarizeForManagementGroup(#[from] policy_states::summarize_for_management_group::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForSubscription(#[from] policy_states::list_query_results_for_subscription::Error), + #[error(transparent)] + PolicyStates_SummarizeForSubscription(#[from] policy_states::summarize_for_subscription::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForResourceGroup(#[from] policy_states::list_query_results_for_resource_group::Error), + #[error(transparent)] + PolicyStates_SummarizeForResourceGroup(#[from] policy_states::summarize_for_resource_group::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForResource(#[from] policy_states::list_query_results_for_resource::Error), + #[error(transparent)] + PolicyStates_SummarizeForResource(#[from] policy_states::summarize_for_resource::Error), + #[error(transparent)] + PolicyStates_TriggerSubscriptionEvaluation(#[from] policy_states::trigger_subscription_evaluation::Error), + #[error(transparent)] + PolicyStates_TriggerResourceGroupEvaluation(#[from] policy_states::trigger_resource_group_evaluation::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForPolicySetDefinition(#[from] policy_states::list_query_results_for_policy_set_definition::Error), + #[error(transparent)] + PolicyStates_SummarizeForPolicySetDefinition(#[from] policy_states::summarize_for_policy_set_definition::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForPolicyDefinition(#[from] policy_states::list_query_results_for_policy_definition::Error), + #[error(transparent)] + PolicyStates_SummarizeForPolicyDefinition(#[from] policy_states::summarize_for_policy_definition::Error), + #[error(transparent)] + PolicyStates_ListQueryResultsForSubscriptionLevelPolicyAssignment( + #[from] policy_states::list_query_results_for_subscription_level_policy_assignment::Error, + ), + #[error(transparent)] + PolicyStates_SummarizeForSubscriptionLevelPolicyAssignment( + #[from] policy_states::summarize_for_subscription_level_policy_assignment::Error, + ), + #[error(transparent)] + PolicyStates_ListQueryResultsForResourceGroupLevelPolicyAssignment( + #[from] policy_states::list_query_results_for_resource_group_level_policy_assignment::Error, + ), + #[error(transparent)] + PolicyStates_SummarizeForResourceGroupLevelPolicyAssignment( + #[from] policy_states::summarize_for_resource_group_level_policy_assignment::Error, + ), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] PolicyMetadata_GetResource(#[from] policy_metadata::get_resource::Error), #[error(transparent)] PolicyMetadata_List(#[from] policy_metadata::list::Error), @@ -2950,6 +3019,181 @@ pub mod policy_events { skiptoken: None, } } + pub fn list_query_results_for_management_group( + &self, + policy_events_resource: impl Into, + management_groups_namespace: impl Into, + management_group_name: impl Into, + ) -> list_query_results_for_management_group::Builder { + list_query_results_for_management_group::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + management_groups_namespace: management_groups_namespace.into(), + management_group_name: management_group_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_subscription( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + ) -> list_query_results_for_subscription::Builder { + list_query_results_for_subscription::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_resource_group( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_query_results_for_resource_group::Builder { + list_query_results_for_resource_group::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_resource( + &self, + policy_events_resource: impl Into, + resource_id: impl Into, + ) -> list_query_results_for_resource::Builder { + list_query_results_for_resource::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + resource_id: resource_id.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + expand: None, + skiptoken: None, + } + } + pub fn list_query_results_for_policy_set_definition( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_set_definition_name: impl Into, + ) -> list_query_results_for_policy_set_definition::Builder { + list_query_results_for_policy_set_definition::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_set_definition_name: policy_set_definition_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_policy_definition( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_definition_name: impl Into, + ) -> list_query_results_for_policy_definition::Builder { + list_query_results_for_policy_definition::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_definition_name: policy_definition_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_subscription_level_policy_assignment( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> list_query_results_for_subscription_level_policy_assignment::Builder { + list_query_results_for_subscription_level_policy_assignment::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn list_query_results_for_resource_group_level_policy_assignment( + &self, + policy_events_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> list_query_results_for_resource_group_level_policy_assignment::Builder { + list_query_results_for_resource_group_level_policy_assignment::Builder { + client: self.0.clone(), + policy_events_resource: policy_events_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } } pub mod next_link { use super::models; @@ -3029,20 +3273,7 @@ pub mod policy_events { } } } -} -pub mod policy_states { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn next_link(&self, next_link: impl Into) -> next_link::Builder { - next_link::Builder { - client: self.0.clone(), - next_link: next_link.into(), - skiptoken: None, - } - } - } - pub mod next_link { + pub mod list_query_results_for_management_group { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3069,17 +3300,60 @@ pub mod policy_states { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) next_link: String, + pub(crate) policy_events_resource: String, + pub(crate) management_groups_namespace: String, + pub(crate) management_group_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, pub(crate) skiptoken: Option, } impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { self.skiptoken = Some(skiptoken.into()); self } - 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!("{}{}?Next paging op for policy states", self.client.endpoint(), &self.next_link); + let url_str = &format!( + "{}/providers/{}/managementGroups/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults", + self.client.endpoint(), + &self.management_groups_namespace, + &self.management_group_name, + &self.policy_events_resource + ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::POST); @@ -3090,6 +3364,27 @@ pub mod policy_states { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } if let Some(skiptoken) = &self.skiptoken { url.query_pairs_mut().append_pair("$skiptoken", skiptoken); } @@ -3102,7 +3397,3618 @@ pub mod policy_states { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::PolicyStatesQueryResults = + let rsp_value: models::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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.PolicyInsights/policyEvents/{}/queryResults", + self.client.endpoint(), + &self.subscription_id, + &self.policy_events_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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.PolicyInsights/policyEvents/{}/queryResults", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.policy_events_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) resource_id: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) expand: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults", + self.client.endpoint(), + &self.resource_id, + &self.policy_events_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_policy_set_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_set_definition_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policySetDefinitions/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_set_definition_name , & self . policy_events_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_policy_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_definition_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policyDefinitions/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_definition_name , & self . policy_events_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_subscription_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_events_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource_group_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_events_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyEvents/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_events_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyEventsQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod policy_states { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn next_link(&self, next_link: impl Into) -> next_link::Builder { + next_link::Builder { + client: self.0.clone(), + next_link: next_link.into(), + skiptoken: None, + } + } + pub fn list_query_results_for_management_group( + &self, + policy_states_resource: impl Into, + management_groups_namespace: impl Into, + management_group_name: impl Into, + ) -> list_query_results_for_management_group::Builder { + list_query_results_for_management_group::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + management_groups_namespace: management_groups_namespace.into(), + management_group_name: management_group_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_management_group( + &self, + policy_states_summary_resource: impl Into, + management_groups_namespace: impl Into, + management_group_name: impl Into, + ) -> summarize_for_management_group::Builder { + summarize_for_management_group::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + management_groups_namespace: management_groups_namespace.into(), + management_group_name: management_group_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_subscription( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + ) -> list_query_results_for_subscription::Builder { + list_query_results_for_subscription::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_subscription( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + ) -> summarize_for_subscription::Builder { + summarize_for_subscription::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_resource_group( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_query_results_for_resource_group::Builder { + list_query_results_for_resource_group::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_resource_group( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> summarize_for_resource_group::Builder { + summarize_for_resource_group::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_resource( + &self, + policy_states_resource: impl Into, + resource_id: impl Into, + ) -> list_query_results_for_resource::Builder { + list_query_results_for_resource::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + resource_id: resource_id.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + expand: None, + skiptoken: None, + } + } + pub fn summarize_for_resource( + &self, + policy_states_summary_resource: impl Into, + resource_id: impl Into, + ) -> summarize_for_resource::Builder { + summarize_for_resource::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + resource_id: resource_id.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn trigger_subscription_evaluation(&self, subscription_id: impl Into) -> trigger_subscription_evaluation::Builder { + trigger_subscription_evaluation::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn trigger_resource_group_evaluation( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> trigger_resource_group_evaluation::Builder { + trigger_resource_group_evaluation::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn list_query_results_for_policy_set_definition( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_set_definition_name: impl Into, + ) -> list_query_results_for_policy_set_definition::Builder { + list_query_results_for_policy_set_definition::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_set_definition_name: policy_set_definition_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_policy_set_definition( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_set_definition_name: impl Into, + ) -> summarize_for_policy_set_definition::Builder { + summarize_for_policy_set_definition::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_set_definition_name: policy_set_definition_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_policy_definition( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_definition_name: impl Into, + ) -> list_query_results_for_policy_definition::Builder { + list_query_results_for_policy_definition::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_definition_name: policy_definition_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_policy_definition( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_definition_name: impl Into, + ) -> summarize_for_policy_definition::Builder { + summarize_for_policy_definition::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_definition_name: policy_definition_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_subscription_level_policy_assignment( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> list_query_results_for_subscription_level_policy_assignment::Builder { + list_query_results_for_subscription_level_policy_assignment::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_subscription_level_policy_assignment( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> summarize_for_subscription_level_policy_assignment::Builder { + summarize_for_subscription_level_policy_assignment::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + pub fn list_query_results_for_resource_group_level_policy_assignment( + &self, + policy_states_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> list_query_results_for_resource_group_level_policy_assignment::Builder { + list_query_results_for_resource_group_level_policy_assignment::Builder { + client: self.0.clone(), + policy_states_resource: policy_states_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + orderby: None, + select: None, + from: None, + to: None, + filter: None, + apply: None, + skiptoken: None, + } + } + pub fn summarize_for_resource_group_level_policy_assignment( + &self, + policy_states_summary_resource: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + authorization_namespace: impl Into, + policy_assignment_name: impl Into, + ) -> summarize_for_resource_group_level_policy_assignment::Builder { + summarize_for_resource_group_level_policy_assignment::Builder { + client: self.0.clone(), + policy_states_summary_resource: policy_states_summary_resource.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + authorization_namespace: authorization_namespace.into(), + policy_assignment_name: policy_assignment_name.into(), + top: None, + from: None, + to: None, + filter: None, + } + } + } + pub mod next_link { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) next_link: String, + pub(crate) skiptoken: Option, + } + impl Builder { + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}{}?Next paging op for policy states", self.client.endpoint(), &self.next_link); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_management_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) management_groups_namespace: String, + pub(crate) management_group_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/{}/managementGroups/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults", + self.client.endpoint(), + &self.management_groups_namespace, + &self.management_group_name, + &self.policy_states_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_management_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) management_groups_namespace: String, + pub(crate) management_group_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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!( + "{}/providers/{}/managementGroups/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize", + self.client.endpoint(), + &self.management_groups_namespace, + &self.management_group_name, + &self.policy_states_summary_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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.PolicyInsights/policyStates/{}/queryResults", + self.client.endpoint(), + &self.subscription_id, + &self.policy_states_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize", + self.client.endpoint(), + &self.subscription_id, + &self.policy_states_summary_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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.PolicyInsights/policyStates/{}/queryResults", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.policy_states_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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.PolicyInsights/policyStates/{}/summarize", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.policy_states_summary_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) resource_id: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) expand: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults", + self.client.endpoint(), + &self.resource_id, + &self.policy_states_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_resource { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) resource_id: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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!( + "{}/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize", + self.client.endpoint(), + &self.resource_id, + &self.policy_states_summary_resource + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_subscription_evaluation { + use super::models; + #[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::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.PolicyInsights/policyStates/latest/triggerEvaluation", + 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", "2019-10-01"); + 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::QueryFailure = + serde_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_resource_group_evaluation { + use super::models; + #[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::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, 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.PolicyInsights/policyStates/latest/triggerEvaluation", + 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::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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::QueryFailure = + serde_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_query_results_for_policy_set_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_set_definition_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policySetDefinitions/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_set_definition_name , & self . policy_states_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_policy_set_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_set_definition_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/providers/{}/policySetDefinitions/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_set_definition_name , & self . policy_states_summary_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_policy_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_definition_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policyDefinitions/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_definition_name , & self . policy_states_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_policy_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_definition_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/providers/{}/policyDefinitions/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_definition_name , & self . policy_states_summary_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_subscription_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_states_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_subscription_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/providers/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize" , self . client . endpoint () , & self . subscription_id , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_states_summary_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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_query_results_for_resource_group_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) orderby: Option, + pub(crate) select: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + pub(crate) apply: Option, + pub(crate) skiptoken: Option, + } + impl Builder { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn apply(mut self, apply: impl Into) -> Self { + self.apply = Some(apply.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.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/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyStates/{}/queryResults" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_states_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + 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); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(apply) = &self.apply { + url.query_pairs_mut().append_pair("$apply", apply); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + 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::PolicyStatesQueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod summarize_for_resource_group_level_policy_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) policy_states_summary_resource: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) authorization_namespace: String, + pub(crate) policy_assignment_name: String, + pub(crate) top: Option, + pub(crate) from: Option, + pub(crate) to: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn from(mut self, from: impl Into) -> Self { + self.from = Some(from.into()); + self + } + pub fn to(mut self, to: impl Into) -> Self { + self.to = Some(to.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/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . authorization_namespace , & self . policy_assignment_name , & self . policy_states_summary_resource) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-10-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(from) = &self.from { + url.query_pairs_mut().append_pair("$from", from); + } + if let Some(to) = &self.to { + url.query_pairs_mut().append_pair("$to", to); + } + 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::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SummarizeResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryFailure = + serde_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; + 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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::QueryFailure, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.PolicyInsights/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", "2019-10-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationsListResults = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } diff --git a/services/mgmt/resources/README.md b/services/mgmt/resources/README.md index 095e9bbaa9..ff0a3d17c2 100644 --- a/services/mgmt/resources/README.md +++ b/services/mgmt/resources/README.md @@ -16,7 +16,7 @@ The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/servi - `package-locks-2020-05` has 17 operations from 1 API versions: `2020-05-01`. Use crate feature `package-locks-2020-05` to enable. The operations will be in the `package_locks_2020_05` module. - `package-resources-2021-04` has 95 operations from 1 API versions: `2021-04-01`. Use crate feature `package-resources-2021-04` to enable. The operations will be in the `package_resources_2021_04` module. - `package-locks-2017-04` has 17 operations from 1 API versions: `2017-04-01`. Use crate feature `package-locks-2017-04` to enable. The operations will be in the `package_locks_2017_04` module. -- `package-preview-2020-08` has 3 operations from 1 API versions: `2020-08-21-preview`. Use crate feature `package-preview-2020-08` to enable. The operations will be in the `package_preview_2020_08` module. +- `package-preview-2020-08` has 25 operations from 1 API versions: `2020-08-21-preview`. Use crate feature `package-preview-2020-08` to enable. The operations will be in the `package_preview_2020_08` module. - `package-subscriptions-2021-01` has 6 operations from 1 API versions: `2021-01-01`. Use crate feature `package-subscriptions-2021-01` to enable. The operations will be in the `package_subscriptions_2021_01` module. - `package-deploymentscripts-2020-10` has 8 operations from 1 API versions: `2020-10-01`. Use crate feature `package-deploymentscripts-2020-10` to enable. The operations will be in the `package_deploymentscripts_2020_10` module. - `package-deploymentscripts-2019-10-preview` has 8 operations from 1 API versions: `2019-10-01-preview`. Use crate feature `package-deploymentscripts-2019-10-preview` to enable. The operations will be in the `package_deploymentscripts_2019_10_preview` module. @@ -61,7 +61,7 @@ The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/servi - `package-subscriptions-2016-06` has 7 operations from 1 API versions: `2016-06-01`. Use crate feature `package-subscriptions-2016-06` to enable. The operations will be in the `package_subscriptions_2016_06` module. - `package-subscriptions-2015-11` has 6 operations from 1 API versions: `2015-11-01`. Use crate feature `package-subscriptions-2015-11` to enable. The operations will be in the `package_subscriptions_2015_11` module. - `package-links-2016-09` has 6 operations from 1 API versions: `2016-09-01`. Use crate feature `package-links-2016-09` to enable. The operations will be in the `package_links_2016_09` module. -- `package-managedapplications-2019-07` has 3 operations from 1 API versions: `2019-07-01`. Use crate feature `package-managedapplications-2019-07` to enable. The operations will be in the `package_managedapplications_2019_07` module. -- `package-managedapplications-2018-06` has 3 operations from 1 API versions: `2018-06-01`. Use crate feature `package-managedapplications-2018-06` to enable. The operations will be in the `package_managedapplications_2018_06` module. +- `package-managedapplications-2019-07` has 25 operations from 1 API versions: `2019-07-01`. Use crate feature `package-managedapplications-2019-07` to enable. The operations will be in the `package_managedapplications_2019_07` module. +- `package-managedapplications-2018-06` has 18 operations from 1 API versions: `2018-06-01`. Use crate feature `package-managedapplications-2018-06` to enable. The operations will be in the `package_managedapplications_2018_06` module. - `package-managedapplications-2017-09` has 17 operations from 1 API versions: `2017-09-01`. Use crate feature `package-managedapplications-2017-09` to enable. The operations will be in the `package_managedapplications_2017_09` module. - `package-managedapplications-2016-09` has 18 operations from 1 API versions: `2016-09-01-preview`. Use crate feature `package-managedapplications-2016-09` to enable. The operations will be in the `package_managedapplications_2016_09` module. \ No newline at end of file diff --git a/services/mgmt/resources/src/package_managedapplications_2018_06/operations.rs b/services/mgmt/resources/src/package_managedapplications_2018_06/operations.rs index 77d4c25ccc..2cb534a500 100644 --- a/services/mgmt/resources/src/package_managedapplications_2018_06/operations.rs +++ b/services/mgmt/resources/src/package_managedapplications_2018_06/operations.rs @@ -77,6 +77,9 @@ impl Client { pub fn application_definitions(&self) -> application_definitions::Client { application_definitions::Client(self.clone()) } + pub fn applications(&self) -> applications::Client { + applications::Client(self.clone()) + } } #[non_exhaustive] #[derive(Debug, thiserror :: Error)] @@ -88,6 +91,36 @@ pub enum Error { ApplicationDefinitions_CreateOrUpdateById(#[from] application_definitions::create_or_update_by_id::Error), #[error(transparent)] ApplicationDefinitions_DeleteById(#[from] application_definitions::delete_by_id::Error), + #[error(transparent)] + ListOperations(#[from] list_operations::Error), + #[error(transparent)] + Applications_Get(#[from] applications::get::Error), + #[error(transparent)] + Applications_CreateOrUpdate(#[from] applications::create_or_update::Error), + #[error(transparent)] + Applications_Update(#[from] applications::update::Error), + #[error(transparent)] + Applications_Delete(#[from] applications::delete::Error), + #[error(transparent)] + ApplicationDefinitions_Get(#[from] application_definitions::get::Error), + #[error(transparent)] + ApplicationDefinitions_CreateOrUpdate(#[from] application_definitions::create_or_update::Error), + #[error(transparent)] + ApplicationDefinitions_Delete(#[from] application_definitions::delete::Error), + #[error(transparent)] + ApplicationDefinitions_ListByResourceGroup(#[from] application_definitions::list_by_resource_group::Error), + #[error(transparent)] + Applications_ListByResourceGroup(#[from] applications::list_by_resource_group::Error), + #[error(transparent)] + Applications_ListBySubscription(#[from] applications::list_by_subscription::Error), + #[error(transparent)] + Applications_GetById(#[from] applications::get_by_id::Error), + #[error(transparent)] + Applications_CreateOrUpdateById(#[from] applications::create_or_update_by_id::Error), + #[error(transparent)] + Applications_UpdateById(#[from] applications::update_by_id::Error), + #[error(transparent)] + Applications_DeleteById(#[from] applications::delete_by_id::Error), } pub mod application_definitions { use super::models; @@ -134,6 +167,58 @@ pub mod application_definitions { subscription_id: subscription_id.into(), } } + pub fn get( + &self, + resource_group_name: impl Into, + application_definition_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_definition_name: application_definition_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + application_definition_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(), + application_definition_name: application_definition_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + application_definition_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_definition_name: application_definition_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 mod get_by_id { use super::models; @@ -367,4 +452,1293 @@ pub mod application_definitions { } } } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_definition_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.Solutions/applicationDefinitions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.application_definition_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2018-06-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationDefinition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + 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; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApplicationDefinition), + Created201(models::ApplicationDefinition), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_definition_name: String, + pub(crate) parameters: models::ApplicationDefinition, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Solutions/applicationDefinitions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.application_definition_name + ); + let mut url = 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", "2018-06-01"); + 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::ApplicationDefinition = + 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::ApplicationDefinition = + 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; + #[derive(Debug)] + pub enum Response { + NoContent204, + 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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_definition_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.Solutions/applicationDefinitions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.application_definition_name + ); + let mut url = 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", "2018-06-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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(Response::NoContent204), + 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 list_by_resource_group { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.Solutions/applicationDefinitions", + 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", "2018-06-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationDefinitionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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, + }) + } + } + }) + } + } + } +} +impl Client { + pub fn list_operations(&self) -> list_operations::Builder { + list_operations::Builder { client: self.clone() } + } +} +pub mod list_operations { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: 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.Solutions/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", "2018-06-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match 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 applications { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + application_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_name: application_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + application_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(), + application_name: application_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + application_name: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_name: application_name.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + application_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_name: application_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 get_by_id(&self, application_id: impl Into) -> get_by_id::Builder { + get_by_id::Builder { + client: self.0.clone(), + application_id: application_id.into(), + } + } + pub fn create_or_update_by_id( + &self, + application_id: impl Into, + parameters: impl Into, + ) -> create_or_update_by_id::Builder { + create_or_update_by_id::Builder { + client: self.0.clone(), + application_id: application_id.into(), + parameters: parameters.into(), + } + } + pub fn update_by_id(&self, application_id: impl Into) -> update_by_id::Builder { + update_by_id::Builder { + client: self.0.clone(), + application_id: application_id.into(), + parameters: None, + } + } + pub fn delete_by_id(&self, application_id: impl Into) -> delete_by_id::Builder { + delete_by_id::Builder { + client: self.0.clone(), + application_id: application_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_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.Solutions/applications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.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", "2018-06-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Application = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + 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; + #[derive(Debug)] + pub enum Response { + Ok200(models::Application), + Created201(models::Application), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_name: String, + pub(crate) parameters: models::Application, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Solutions/applications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.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", "2018-06-01"); + 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::Application = + 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::Application = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_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.Solutions/applications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.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", "2018-06-01"); + 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::Application = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + NoContent204, + 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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_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.Solutions/applications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.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", "2018-06-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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(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::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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.Solutions/applications", + 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", "2018-06-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.Solutions/applications", + 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", "2018-06-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) application_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/{}", self.client.endpoint(), &self.application_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", "2018-06-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Application = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + 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_by_id { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Application), + Created201(models::Application), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) application_id: String, + pub(crate) parameters: models::Application, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/{}", self.client.endpoint(), &self.application_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", "2018-06-01"); + 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::Application = + 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::Application = + 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_by_id { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) application_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!("{}/{}", self.client.endpoint(), &self.application_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", "2018-06-01"); + 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::Application = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_by_id { + use super::models; + #[derive(Debug)] + pub enum Response { + NoContent204, + 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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) application_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/{}", self.client.endpoint(), &self.application_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", "2018-06-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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(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::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/resources/src/package_managedapplications_2019_07/models.rs b/services/mgmt/resources/src/package_managedapplications_2019_07/models.rs index 7e1e05b0c5..3dba3f883c 100644 --- a/services/mgmt/resources/src/package_managedapplications_2019_07/models.rs +++ b/services/mgmt/resources/src/package_managedapplications_2019_07/models.rs @@ -827,6 +827,21 @@ pub mod operation { } } } +#[doc = "A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationListResult { + #[doc = "List of operations supported by the resource provider"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of operation list results (if there are any)."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl OperationListResult { + pub fn new() -> Self { + Self::default() + } +} #[doc = "Plan for the managed application."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Plan { diff --git a/services/mgmt/resources/src/package_managedapplications_2019_07/operations.rs b/services/mgmt/resources/src/package_managedapplications_2019_07/operations.rs index f843ffa2d8..654f8983e6 100644 --- a/services/mgmt/resources/src/package_managedapplications_2019_07/operations.rs +++ b/services/mgmt/resources/src/package_managedapplications_2019_07/operations.rs @@ -77,6 +77,12 @@ impl Client { pub fn application_definitions(&self) -> application_definitions::Client { application_definitions::Client(self.clone()) } + pub fn applications(&self) -> applications::Client { + applications::Client(self.clone()) + } + pub fn jit_requests(&self) -> jit_requests::Client { + jit_requests::Client(self.clone()) + } } #[non_exhaustive] #[derive(Debug, thiserror :: Error)] @@ -88,6 +94,50 @@ pub enum Error { ApplicationDefinitions_CreateOrUpdateById(#[from] application_definitions::create_or_update_by_id::Error), #[error(transparent)] ApplicationDefinitions_DeleteById(#[from] application_definitions::delete_by_id::Error), + #[error(transparent)] + ListOperations(#[from] list_operations::Error), + #[error(transparent)] + Applications_Get(#[from] applications::get::Error), + #[error(transparent)] + Applications_CreateOrUpdate(#[from] applications::create_or_update::Error), + #[error(transparent)] + Applications_Update(#[from] applications::update::Error), + #[error(transparent)] + Applications_Delete(#[from] applications::delete::Error), + #[error(transparent)] + ApplicationDefinitions_Get(#[from] application_definitions::get::Error), + #[error(transparent)] + ApplicationDefinitions_CreateOrUpdate(#[from] application_definitions::create_or_update::Error), + #[error(transparent)] + ApplicationDefinitions_Delete(#[from] application_definitions::delete::Error), + #[error(transparent)] + ApplicationDefinitions_ListByResourceGroup(#[from] application_definitions::list_by_resource_group::Error), + #[error(transparent)] + Applications_ListByResourceGroup(#[from] applications::list_by_resource_group::Error), + #[error(transparent)] + Applications_ListBySubscription(#[from] applications::list_by_subscription::Error), + #[error(transparent)] + Applications_GetById(#[from] applications::get_by_id::Error), + #[error(transparent)] + Applications_CreateOrUpdateById(#[from] applications::create_or_update_by_id::Error), + #[error(transparent)] + Applications_UpdateById(#[from] applications::update_by_id::Error), + #[error(transparent)] + Applications_DeleteById(#[from] applications::delete_by_id::Error), + #[error(transparent)] + JitRequests_Get(#[from] jit_requests::get::Error), + #[error(transparent)] + JitRequests_CreateOrUpdate(#[from] jit_requests::create_or_update::Error), + #[error(transparent)] + JitRequests_Update(#[from] jit_requests::update::Error), + #[error(transparent)] + JitRequests_Delete(#[from] jit_requests::delete::Error), + #[error(transparent)] + JitRequests_ListBySubscription(#[from] jit_requests::list_by_subscription::Error), + #[error(transparent)] + JitRequests_ListByResourceGroup(#[from] jit_requests::list_by_resource_group::Error), + #[error(transparent)] + Applications_RefreshPermissions(#[from] applications::refresh_permissions::Error), } pub mod application_definitions { use super::models; @@ -134,6 +184,58 @@ pub mod application_definitions { subscription_id: subscription_id.into(), } } + pub fn get( + &self, + resource_group_name: impl Into, + application_definition_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_definition_name: application_definition_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + application_definition_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(), + application_definition_name: application_definition_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + application_definition_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_definition_name: application_definition_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 mod get_by_id { use super::models; @@ -364,4 +466,1931 @@ pub mod application_definitions { } } } + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_definition_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.Solutions/applicationDefinitions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.application_definition_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-07-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationDefinition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApplicationDefinition), + Created201(models::ApplicationDefinition), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_definition_name: String, + pub(crate) parameters: models::ApplicationDefinition, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Solutions/applicationDefinitions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.application_definition_name + ); + let mut url = 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", "2019-07-01"); + 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::ApplicationDefinition = + 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::ApplicationDefinition = + 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; + #[derive(Debug)] + pub enum Response { + NoContent204, + 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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_definition_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.Solutions/applicationDefinitions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.application_definition_name + ); + let mut url = 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", "2019-07-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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(Response::NoContent204), + 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 list_by_resource_group { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.Solutions/applicationDefinitions", + 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", "2019-07-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationDefinitionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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, + }) + } + } + }) + } + } + } +} +impl Client { + pub fn list_operations(&self) -> list_operations::Builder { + list_operations::Builder { client: self.clone() } + } +} +pub mod list_operations { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: 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.Solutions/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", "2019-07-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match 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 applications { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + application_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_name: application_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + application_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(), + application_name: application_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + application_name: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_name: application_name.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + application_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_name: application_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 get_by_id(&self, application_id: impl Into) -> get_by_id::Builder { + get_by_id::Builder { + client: self.0.clone(), + application_id: application_id.into(), + } + } + pub fn create_or_update_by_id( + &self, + application_id: impl Into, + parameters: impl Into, + ) -> create_or_update_by_id::Builder { + create_or_update_by_id::Builder { + client: self.0.clone(), + application_id: application_id.into(), + parameters: parameters.into(), + } + } + pub fn update_by_id(&self, application_id: impl Into) -> update_by_id::Builder { + update_by_id::Builder { + client: self.0.clone(), + application_id: application_id.into(), + parameters: None, + } + } + pub fn delete_by_id(&self, application_id: impl Into) -> delete_by_id::Builder { + delete_by_id::Builder { + client: self.0.clone(), + application_id: application_id.into(), + } + } + pub fn refresh_permissions( + &self, + resource_group_name: impl Into, + application_name: impl Into, + subscription_id: impl Into, + ) -> refresh_permissions::Builder { + refresh_permissions::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_name: application_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_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.Solutions/applications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.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", "2019-07-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Application = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Ok200(models::Application), + Created201(models::Application), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_name: String, + pub(crate) parameters: models::Application, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Solutions/applications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.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", "2019-07-01"); + 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::Application = + 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::Application = + 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; + #[derive(Debug)] + pub enum Response { + Ok200(models::Application), + 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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_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.Solutions/applications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.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", "2019-07-01"); + 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::Application = + 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; + #[derive(Debug)] + pub enum Response { + NoContent204, + 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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_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.Solutions/applications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.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", "2019-07-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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(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::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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.Solutions/applications", + 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", "2019-07-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.Solutions/applications", + 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", "2019-07-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) application_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/{}", self.client.endpoint(), &self.application_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", "2019-07-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Application = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_by_id { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Application), + Created201(models::Application), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) application_id: String, + pub(crate) parameters: models::Application, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/{}", self.client.endpoint(), &self.application_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", "2019-07-01"); + 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::Application = + 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::Application = + 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_by_id { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) application_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!("{}/{}", self.client.endpoint(), &self.application_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", "2019-07-01"); + 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::Application = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_by_id { + use super::models; + #[derive(Debug)] + pub enum Response { + NoContent204, + 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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) application_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/{}", self.client.endpoint(), &self.application_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", "2019-07-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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(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::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 refresh_permissions { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_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.Solutions/applications/{}/refreshPermissions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.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::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-07-01"); + 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::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 jit_requests { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + jit_request_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + jit_request_name: jit_request_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + jit_request_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(), + jit_request_name: jit_request_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + jit_request_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(), + jit_request_name: jit_request_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + jit_request_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + jit_request_name: jit_request_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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) jit_request_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.Solutions/jitRequests/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.jit_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", "2019-07-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::JitRequestDefinition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + Created201(models::JitRequestDefinition), + Ok200(models::JitRequestDefinition), + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) jit_request_name: String, + pub(crate) parameters: models::JitRequestDefinition, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Solutions/jitRequests/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.jit_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::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", "2019-07-01"); + 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::JitRequestDefinition = + 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::JitRequestDefinition = + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) jit_request_name: String, + pub(crate) parameters: models::JitRequestPatchable, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Solutions/jitRequests/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.jit_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::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", "2019-07-01"); + 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::JitRequestDefinition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[derive(Debug)] + pub enum Response { + NoContent204, + Ok200, + } + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) jit_request_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.Solutions/jitRequests/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.jit_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::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", "2019-07-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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(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::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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.Solutions/jitRequests", + 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", "2019-07-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::JitRequestDefinitionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.Solutions/jitRequests", + 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", "2019-07-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::JitRequestDefinitionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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/resources/src/package_preview_2020_08/operations.rs b/services/mgmt/resources/src/package_preview_2020_08/operations.rs index 5fde6894fb..ac167e781c 100644 --- a/services/mgmt/resources/src/package_preview_2020_08/operations.rs +++ b/services/mgmt/resources/src/package_preview_2020_08/operations.rs @@ -77,6 +77,12 @@ impl Client { pub fn application_definitions(&self) -> application_definitions::Client { application_definitions::Client(self.clone()) } + pub fn applications(&self) -> applications::Client { + applications::Client(self.clone()) + } + pub fn jit_requests(&self) -> jit_requests::Client { + jit_requests::Client(self.clone()) + } } #[non_exhaustive] #[derive(Debug, thiserror :: Error)] @@ -88,6 +94,50 @@ pub enum Error { ApplicationDefinitions_CreateOrUpdateById(#[from] application_definitions::create_or_update_by_id::Error), #[error(transparent)] ApplicationDefinitions_DeleteById(#[from] application_definitions::delete_by_id::Error), + #[error(transparent)] + ListOperations(#[from] list_operations::Error), + #[error(transparent)] + Applications_Get(#[from] applications::get::Error), + #[error(transparent)] + Applications_CreateOrUpdate(#[from] applications::create_or_update::Error), + #[error(transparent)] + Applications_Update(#[from] applications::update::Error), + #[error(transparent)] + Applications_Delete(#[from] applications::delete::Error), + #[error(transparent)] + ApplicationDefinitions_Get(#[from] application_definitions::get::Error), + #[error(transparent)] + ApplicationDefinitions_CreateOrUpdate(#[from] application_definitions::create_or_update::Error), + #[error(transparent)] + ApplicationDefinitions_Delete(#[from] application_definitions::delete::Error), + #[error(transparent)] + ApplicationDefinitions_ListByResourceGroup(#[from] application_definitions::list_by_resource_group::Error), + #[error(transparent)] + Applications_ListByResourceGroup(#[from] applications::list_by_resource_group::Error), + #[error(transparent)] + Applications_ListBySubscription(#[from] applications::list_by_subscription::Error), + #[error(transparent)] + Applications_GetById(#[from] applications::get_by_id::Error), + #[error(transparent)] + Applications_CreateOrUpdateById(#[from] applications::create_or_update_by_id::Error), + #[error(transparent)] + Applications_UpdateById(#[from] applications::update_by_id::Error), + #[error(transparent)] + Applications_DeleteById(#[from] applications::delete_by_id::Error), + #[error(transparent)] + JitRequests_Get(#[from] jit_requests::get::Error), + #[error(transparent)] + JitRequests_CreateOrUpdate(#[from] jit_requests::create_or_update::Error), + #[error(transparent)] + JitRequests_Update(#[from] jit_requests::update::Error), + #[error(transparent)] + JitRequests_Delete(#[from] jit_requests::delete::Error), + #[error(transparent)] + JitRequests_ListBySubscription(#[from] jit_requests::list_by_subscription::Error), + #[error(transparent)] + JitRequests_ListByResourceGroup(#[from] jit_requests::list_by_resource_group::Error), + #[error(transparent)] + Applications_RefreshPermissions(#[from] applications::refresh_permissions::Error), } pub mod application_definitions { use super::models; @@ -134,6 +184,58 @@ pub mod application_definitions { subscription_id: subscription_id.into(), } } + pub fn get( + &self, + resource_group_name: impl Into, + application_definition_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_definition_name: application_definition_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + application_definition_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(), + application_definition_name: application_definition_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + application_definition_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_definition_name: application_definition_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 mod get_by_id { use super::models; @@ -364,4 +466,1942 @@ pub mod application_definitions { } } } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_definition_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.Solutions/applicationDefinitions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.application_definition_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-08-21-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationDefinition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApplicationDefinition), + Created201(models::ApplicationDefinition), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_definition_name: String, + pub(crate) parameters: models::ApplicationDefinition, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Solutions/applicationDefinitions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.application_definition_name + ); + let mut url = 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", "2020-08-21-preview"); + 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::ApplicationDefinition = + 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::ApplicationDefinition = + 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; + #[derive(Debug)] + pub enum Response { + NoContent204, + 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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_definition_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.Solutions/applicationDefinitions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.application_definition_name + ); + let mut url = 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", "2020-08-21-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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(Response::NoContent204), + 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_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.Solutions/applicationDefinitions", + 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", "2020-08-21-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationDefinitionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::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 list_operations(&self) -> list_operations::Builder { + list_operations::Builder { client: self.clone() } + } +} +pub mod list_operations { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: 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.Solutions/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", "2020-08-21-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match 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 applications { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + application_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_name: application_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + application_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(), + application_name: application_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + application_name: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_name: application_name.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + application_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_name: application_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 get_by_id(&self, application_id: impl Into) -> get_by_id::Builder { + get_by_id::Builder { + client: self.0.clone(), + application_id: application_id.into(), + } + } + pub fn create_or_update_by_id( + &self, + application_id: impl Into, + parameters: impl Into, + ) -> create_or_update_by_id::Builder { + create_or_update_by_id::Builder { + client: self.0.clone(), + application_id: application_id.into(), + parameters: parameters.into(), + } + } + pub fn update_by_id(&self, application_id: impl Into) -> update_by_id::Builder { + update_by_id::Builder { + client: self.0.clone(), + application_id: application_id.into(), + parameters: None, + } + } + pub fn delete_by_id(&self, application_id: impl Into) -> delete_by_id::Builder { + delete_by_id::Builder { + client: self.0.clone(), + application_id: application_id.into(), + } + } + pub fn refresh_permissions( + &self, + resource_group_name: impl Into, + application_name: impl Into, + subscription_id: impl Into, + ) -> refresh_permissions::Builder { + refresh_permissions::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_name: application_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_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.Solutions/applications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.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", "2020-08-21-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Application = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug)] + pub enum Response { + Ok200(models::Application), + Created201(models::Application), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_name: String, + pub(crate) parameters: models::Application, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Solutions/applications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.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", "2020-08-21-preview"); + 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::Application = + 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::Application = + 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; + #[derive(Debug)] + pub enum Response { + Ok200(models::Application), + 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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_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.Solutions/applications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.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", "2020-08-21-preview"); + 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::Application = + 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; + #[derive(Debug)] + pub enum Response { + 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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_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.Solutions/applications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.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", "2020-08-21-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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(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_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.Solutions/applications", + 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", "2020-08-21-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.Solutions/applications", + 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", "2020-08-21-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) application_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/{}", self.client.endpoint(), &self.application_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", "2020-08-21-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Application = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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_by_id { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Application), + Created201(models::Application), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) application_id: String, + pub(crate) parameters: models::Application, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/{}", self.client.endpoint(), &self.application_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", "2020-08-21-preview"); + 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::Application = + 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::Application = + 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_by_id { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) application_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!("{}/{}", self.client.endpoint(), &self.application_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", "2020-08-21-preview"); + 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::Application = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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_by_id { + use super::models; + #[derive(Debug)] + pub enum Response { + 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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) application_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/{}", self.client.endpoint(), &self.application_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", "2020-08-21-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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(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 refresh_permissions { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_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.Solutions/applications/{}/refreshPermissions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.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::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-08-21-preview"); + 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 jit_requests { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + jit_request_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + jit_request_name: jit_request_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + jit_request_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(), + jit_request_name: jit_request_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + jit_request_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(), + jit_request_name: jit_request_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + jit_request_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + jit_request_name: jit_request_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) jit_request_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.Solutions/jitRequests/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.jit_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", "2020-08-21-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::JitRequestDefinition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug)] + pub enum Response { + Created201(models::JitRequestDefinition), + Ok200(models::JitRequestDefinition), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) jit_request_name: String, + pub(crate) parameters: models::JitRequestDefinition, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Solutions/jitRequests/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.jit_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::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", "2020-08-21-preview"); + 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::JitRequestDefinition = + 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::JitRequestDefinition = + 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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) jit_request_name: String, + pub(crate) parameters: models::JitRequestPatchable, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Solutions/jitRequests/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.jit_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::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", "2020-08-21-preview"); + 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::JitRequestDefinition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug)] + pub enum Response { + 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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) jit_request_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.Solutions/jitRequests/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.jit_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::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", "2020-08-21-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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(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 list_by_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.Solutions/jitRequests", + 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", "2020-08-21-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::JitRequestDefinitionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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.Solutions/jitRequests", + 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", "2020-08-21-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::JitRequestDefinitionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::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/vmware/Cargo.toml b/services/mgmt/vmware/Cargo.toml index 0b5600529d..a21a7ed913 100644 --- a/services/mgmt/vmware/Cargo.toml +++ b/services/mgmt/vmware/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_vmware" -version = "0.2.1" +version = "0.2.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/containerregistry/README.md b/services/svc/containerregistry/README.md index 4d516e6219..3ad1e445f5 100644 --- a/services/svc/containerregistry/README.md +++ b/services/svc/containerregistry/README.md @@ -10,6 +10,6 @@ The default tag is `package-2019-08`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: -- `package-2019-08` has 3 operations from 1 API versions: `2019-08-15-preview`. Use crate feature `package-2019-08` to enable. The operations will be in the `package_2019_08` module. +- `package-2019-08` has 29 operations from 1 API versions: `2019-08-15-preview`. Use crate feature `package-2019-08` to enable. The operations will be in the `package_2019_08` module. - `package-2019-07` has 20 operations from 1 API versions: `2019-07-15-preview`. Use crate feature `package-2019-07` to enable. The operations will be in the `package_2019_07` module. - `package-2018-08` has 15 operations from 1 API versions: `2018-08-10-preview`. Use crate feature `package-2018-08` to enable. The operations will be in the `package_2018_08` module. \ No newline at end of file diff --git a/services/svc/containerregistry/src/package_2019_08/operations.rs b/services/svc/containerregistry/src/package_2019_08/operations.rs index a0c190af48..cb5d81609a 100644 --- a/services/svc/containerregistry/src/package_2019_08/operations.rs +++ b/services/svc/containerregistry/src/package_2019_08/operations.rs @@ -74,9 +74,27 @@ impl Client { pipeline, } } + pub fn access_tokens(&self) -> access_tokens::Client { + access_tokens::Client(self.clone()) + } pub fn blob(&self) -> blob::Client { blob::Client(self.clone()) } + pub fn manifests(&self) -> manifests::Client { + manifests::Client(self.clone()) + } + pub fn refresh_tokens(&self) -> refresh_tokens::Client { + refresh_tokens::Client(self.clone()) + } + pub fn repository(&self) -> repository::Client { + repository::Client(self.clone()) + } + pub fn tag(&self) -> tag::Client { + tag::Client(self.clone()) + } + pub fn v2_support(&self) -> v2_support::Client { + v2_support::Client(self.clone()) + } } #[non_exhaustive] #[derive(Debug, thiserror :: Error)] @@ -88,6 +106,58 @@ pub enum Error { Blob_GetChunk(#[from] blob::get_chunk::Error), #[error(transparent)] Blob_CheckChunk(#[from] blob::check_chunk::Error), + #[error(transparent)] + V2Support_Check(#[from] v2_support::check::Error), + #[error(transparent)] + Manifests_Get(#[from] manifests::get::Error), + #[error(transparent)] + Manifests_Create(#[from] manifests::create::Error), + #[error(transparent)] + Manifests_Delete(#[from] manifests::delete::Error), + #[error(transparent)] + Blob_Get(#[from] blob::get::Error), + #[error(transparent)] + Blob_Delete(#[from] blob::delete::Error), + #[error(transparent)] + Blob_Check(#[from] blob::check::Error), + #[error(transparent)] + Blob_Mount(#[from] blob::mount::Error), + #[error(transparent)] + Blob_GetStatus(#[from] blob::get_status::Error), + #[error(transparent)] + Blob_EndUpload(#[from] blob::end_upload::Error), + #[error(transparent)] + Blob_Upload(#[from] blob::upload::Error), + #[error(transparent)] + Blob_CancelUpload(#[from] blob::cancel_upload::Error), + #[error(transparent)] + Repository_GetList(#[from] repository::get_list::Error), + #[error(transparent)] + Repository_GetAttributes(#[from] repository::get_attributes::Error), + #[error(transparent)] + Repository_UpdateAttributes(#[from] repository::update_attributes::Error), + #[error(transparent)] + Repository_Delete(#[from] repository::delete::Error), + #[error(transparent)] + Tag_GetList(#[from] tag::get_list::Error), + #[error(transparent)] + Tag_GetAttributes(#[from] tag::get_attributes::Error), + #[error(transparent)] + Tag_UpdateAttributes(#[from] tag::update_attributes::Error), + #[error(transparent)] + Tag_Delete(#[from] tag::delete::Error), + #[error(transparent)] + Manifests_GetList(#[from] manifests::get_list::Error), + #[error(transparent)] + Manifests_GetAttributes(#[from] manifests::get_attributes::Error), + #[error(transparent)] + Manifests_UpdateAttributes(#[from] manifests::update_attributes::Error), + #[error(transparent)] + RefreshTokens_GetFromExchange(#[from] refresh_tokens::get_from_exchange::Error), + #[error(transparent)] + AccessTokens_GetFromLogin(#[from] access_tokens::get_from_login::Error), + #[error(transparent)] + AccessTokens_Get(#[from] access_tokens::get::Error), } pub mod blob { use super::models; @@ -115,6 +185,62 @@ pub mod blob { range: range.into(), } } + pub fn get(&self, name: impl Into, digest: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + name: name.into(), + digest: digest.into(), + } + } + pub fn delete(&self, name: impl Into, digest: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + name: name.into(), + digest: digest.into(), + } + } + pub fn check(&self, name: impl Into, digest: impl Into) -> check::Builder { + check::Builder { + client: self.0.clone(), + name: name.into(), + digest: digest.into(), + } + } + pub fn mount(&self, name: impl Into, from: impl Into, mount: impl Into) -> mount::Builder { + mount::Builder { + client: self.0.clone(), + name: name.into(), + from: from.into(), + mount: mount.into(), + } + } + pub fn get_status(&self, next_blob_uuid_link: impl Into) -> get_status::Builder { + get_status::Builder { + client: self.0.clone(), + next_blob_uuid_link: next_blob_uuid_link.into(), + } + } + pub fn end_upload(&self, digest: impl Into, next_blob_uuid_link: impl Into) -> end_upload::Builder { + end_upload::Builder { + client: self.0.clone(), + digest: digest.into(), + next_blob_uuid_link: next_blob_uuid_link.into(), + value: None, + } + } + pub fn upload(&self, value: impl Into, next_blob_uuid_link: impl Into) -> upload::Builder { + upload::Builder { + client: self.0.clone(), + value: value.into(), + next_blob_uuid_link: next_blob_uuid_link.into(), + } + } + pub fn cancel_upload(&self, next_blob_uuid_link: impl Into) -> cancel_upload::Builder { + cancel_upload::Builder { + client: self.0.clone(), + next_blob_uuid_link: next_blob_uuid_link.into(), + } + } } pub mod start_upload { use super::models; @@ -316,4 +442,2075 @@ pub mod blob { } } } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + TemporaryRedirect307 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AcrErrors, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + pub(crate) digest: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/v2/{}/blobs/{}", self.client.endpoint(), &self.name, &self.digest); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_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 = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + 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) + } + http::StatusCode::TEMPORARY_REDIRECT => Err(Error::TemporaryRedirect307 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AcrErrors = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AcrErrors, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + pub(crate) digest: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/v2/{}/blobs/{}", self.client.endpoint(), &self.name, &self.digest); + let mut url = 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())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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 = 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::AcrErrors = + serde_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 { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + TemporaryRedirect307 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AcrErrors, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + pub(crate) digest: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/v2/{}/blobs/{}", self.client.endpoint(), &self.name, &self.digest); + let mut url = 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())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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(()), + http::StatusCode::TEMPORARY_REDIRECT => Err(Error::TemporaryRedirect307 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AcrErrors = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod mount { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AcrErrors, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + pub(crate) from: String, + pub(crate) mount: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/v2/{}/blobs/uploads/", self.client.endpoint(), &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())); + let from = &self.from; + url.query_pairs_mut().append_pair("from", from); + let mount = &self.mount; + url.query_pairs_mut().append_pair("mount", mount); + 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::CREATED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AcrErrors = + serde_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_status { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AcrErrors, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) next_blob_uuid_link: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/{}", self.client.endpoint(), &self.next_blob_uuid_link); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_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 = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::AcrErrors = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod end_upload { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AcrErrors, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) digest: String, + pub(crate) next_blob_uuid_link: String, + pub(crate) value: Option, + } + impl Builder { + pub fn value(mut self, value: impl Into) -> Self { + self.value = Some(value.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/{}", self.client.endpoint(), &self.next_blob_uuid_link); + let mut url = 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 digest = &self.digest; + url.query_pairs_mut().append_pair("digest", digest); + let req_body = if let Some(value) = &self.value { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(value).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 => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AcrErrors = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod upload { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AcrErrors, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) value: serde_json::Value, + pub(crate) next_blob_uuid_link: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/{}", self.client.endpoint(), &self.next_blob_uuid_link); + let mut url = 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())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.value).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::AcrErrors = + serde_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_upload { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AcrErrors, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) next_blob_uuid_link: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/{}", self.client.endpoint(), &self.next_blob_uuid_link); + let mut url = 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())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::AcrErrors = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod v2_support { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn check(&self) -> check::Builder { + check::Builder { client: self.0.clone() } + } + } + pub mod check { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AcrErrors, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/v2/", 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())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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::AcrErrors = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod manifests { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get(&self, name: impl Into, reference: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + name: name.into(), + reference: reference.into(), + accept: None, + } + } + pub fn create( + &self, + name: impl Into, + reference: impl Into, + payload: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + name: name.into(), + reference: reference.into(), + payload: payload.into(), + } + } + pub fn delete(&self, name: impl Into, reference: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + name: name.into(), + reference: reference.into(), + } + } + pub fn get_list(&self, name: impl Into) -> get_list::Builder { + get_list::Builder { + client: self.0.clone(), + name: name.into(), + last: None, + n: None, + orderby: None, + } + } + pub fn get_attributes(&self, name: impl Into, reference: impl Into) -> get_attributes::Builder { + get_attributes::Builder { + client: self.0.clone(), + name: name.into(), + reference: reference.into(), + } + } + pub fn update_attributes(&self, name: impl Into, reference: impl Into) -> update_attributes::Builder { + update_attributes::Builder { + client: self.0.clone(), + name: name.into(), + reference: reference.into(), + value: None, + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AcrErrors, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + pub(crate) reference: String, + pub(crate) accept: Option, + } + impl Builder { + pub fn accept(mut self, accept: impl Into) -> Self { + self.accept = Some(accept.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/v2/{}/manifests/{}", self.client.endpoint(), &self.name, &self.reference); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(accept) = &self.accept { + req_builder = req_builder.header("accept", accept); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManifestWrapper = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AcrErrors = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AcrErrors, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + pub(crate) reference: String, + pub(crate) payload: models::Manifest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/v2/{}/manifests/{}", self.client.endpoint(), &self.name, &self.reference); + let mut url = 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())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.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::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: serde_json::Value = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AcrErrors = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AcrErrors, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + pub(crate) reference: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/v2/{}/manifests/{}", self.client.endpoint(), &self.name, &self.reference); + let mut url = 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())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::AcrErrors = + serde_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_list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AcrErrors, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + pub(crate) last: Option, + pub(crate) n: Option, + pub(crate) orderby: Option, + } + impl Builder { + pub fn last(mut self, last: impl Into) -> Self { + self.last = Some(last.into()); + self + } + pub fn n(mut self, n: i64) -> Self { + self.n = Some(n); + 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> { + Box::pin(async move { + let url_str = &format!("{}/acr/v1/{}/_manifests", self.client.endpoint(), &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())); + if let Some(last) = &self.last { + url.query_pairs_mut().append_pair("last", last); + } + if let Some(n) = &self.n { + url.query_pairs_mut().append_pair("n", &n.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: models::AcrManifests = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AcrErrors = + serde_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_attributes { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AcrErrors, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + pub(crate) reference: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/acr/v1/{}/_manifests/{}", self.client.endpoint(), &self.name, &self.reference); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_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 = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManifestAttributes = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AcrErrors = + serde_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_attributes { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AcrErrors, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + pub(crate) reference: String, + pub(crate) value: Option, + } + impl Builder { + pub fn value(mut self, value: impl Into) -> Self { + self.value = Some(value.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/acr/v1/{}/_manifests/{}", self.client.endpoint(), &self.name, &self.reference); + let mut url = 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())); + let req_body = if let Some(value) = &self.value { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(value).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::AcrErrors = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod repository { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_list(&self) -> get_list::Builder { + get_list::Builder { + client: self.0.clone(), + last: None, + n: None, + } + } + pub fn get_attributes(&self, name: impl Into) -> get_attributes::Builder { + get_attributes::Builder { + client: self.0.clone(), + name: name.into(), + } + } + pub fn update_attributes(&self, name: impl Into) -> update_attributes::Builder { + update_attributes::Builder { + client: self.0.clone(), + name: name.into(), + value: None, + } + } + pub fn delete(&self, name: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + name: name.into(), + } + } + } + pub mod get_list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AcrErrors, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) last: Option, + pub(crate) n: Option, + } + impl Builder { + pub fn last(mut self, last: impl Into) -> Self { + self.last = Some(last.into()); + self + } + pub fn n(mut self, n: i64) -> Self { + self.n = Some(n); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/acr/v1/_catalog", 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())); + if let Some(last) = &self.last { + url.query_pairs_mut().append_pair("last", last); + } + if let Some(n) = &self.n { + url.query_pairs_mut().append_pair("n", &n.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::Repositories = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AcrErrors = + serde_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_attributes { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AcrErrors, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/acr/v1/{}", self.client.endpoint(), &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())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RepositoryAttributes = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AcrErrors = + serde_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_attributes { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AcrErrors, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + pub(crate) value: Option, + } + impl Builder { + pub fn value(mut self, value: impl Into) -> Self { + self.value = Some(value.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/acr/v1/{}", self.client.endpoint(), &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())); + let req_body = if let Some(value) = &self.value { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(value).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::AcrErrors = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AcrErrors, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/acr/v1/{}", self.client.endpoint(), &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())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::DeletedRepository = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AcrErrors = + serde_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 { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_list(&self, name: impl Into) -> get_list::Builder { + get_list::Builder { + client: self.0.clone(), + name: name.into(), + last: None, + n: None, + orderby: None, + digest: None, + } + } + pub fn get_attributes(&self, name: impl Into, reference: impl Into) -> get_attributes::Builder { + get_attributes::Builder { + client: self.0.clone(), + name: name.into(), + reference: reference.into(), + } + } + pub fn update_attributes(&self, name: impl Into, reference: impl Into) -> update_attributes::Builder { + update_attributes::Builder { + client: self.0.clone(), + name: name.into(), + reference: reference.into(), + value: None, + } + } + pub fn delete(&self, name: impl Into, reference: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + name: name.into(), + reference: reference.into(), + } + } + } + pub mod get_list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AcrErrors, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + pub(crate) last: Option, + pub(crate) n: Option, + pub(crate) orderby: Option, + pub(crate) digest: Option, + } + impl Builder { + pub fn last(mut self, last: impl Into) -> Self { + self.last = Some(last.into()); + self + } + pub fn n(mut self, n: i64) -> Self { + self.n = Some(n); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn digest(mut self, digest: impl Into) -> Self { + self.digest = Some(digest.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/acr/v1/{}/_tags", self.client.endpoint(), &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())); + if let Some(last) = &self.last { + url.query_pairs_mut().append_pair("last", last); + } + if let Some(n) = &self.n { + url.query_pairs_mut().append_pair("n", &n.to_string()); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("orderby", orderby); + } + if let Some(digest) = &self.digest { + url.query_pairs_mut().append_pair("digest", digest); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AcrErrors = + serde_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_attributes { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AcrErrors, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + pub(crate) reference: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/acr/v1/{}/_tags/{}", self.client.endpoint(), &self.name, &self.reference); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_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 = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagAttributes = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AcrErrors = + serde_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_attributes { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AcrErrors, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + pub(crate) reference: String, + pub(crate) value: Option, + } + impl Builder { + pub fn value(mut self, value: impl Into) -> Self { + self.value = Some(value.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/acr/v1/{}/_tags/{}", self.client.endpoint(), &self.name, &self.reference); + let mut url = 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())); + let req_body = if let Some(value) = &self.value { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(value).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::AcrErrors = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AcrErrors, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + pub(crate) reference: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/acr/v1/{}/_tags/{}", self.client.endpoint(), &self.name, &self.reference); + let mut url = 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())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::AcrErrors = + serde_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_tokens { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_from_exchange(&self, grant_type: impl Into, service: impl Into) -> get_from_exchange::Builder { + get_from_exchange::Builder { + client: self.0.clone(), + grant_type: grant_type.into(), + service: service.into(), + tenant: None, + refresh_token: None, + access_token: None, + } + } + } + pub mod get_from_exchange { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AcrErrors, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) grant_type: String, + pub(crate) service: String, + pub(crate) tenant: Option, + pub(crate) refresh_token: Option, + pub(crate) access_token: Option, + } + impl Builder { + pub fn tenant(mut self, tenant: impl Into) -> Self { + self.tenant = Some(tenant.into()); + self + } + pub fn refresh_token(mut self, refresh_token: impl Into) -> Self { + self.refresh_token = Some(refresh_token.into()); + self + } + pub fn access_token(mut self, access_token: impl Into) -> Self { + self.access_token = Some(access_token.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/oauth2/exchange", 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())); + unimplemented!("form data not yet supported"); + unimplemented!("form data not yet supported"); + unimplemented!("form data not yet supported"); + unimplemented!("form data not yet supported"); + unimplemented!("form data not yet supported"); + 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::RefreshToken = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AcrErrors = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod access_tokens { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_from_login(&self, service: impl Into, scope: impl Into) -> get_from_login::Builder { + get_from_login::Builder { + client: self.0.clone(), + service: service.into(), + scope: scope.into(), + } + } + pub fn get( + &self, + grant_type: impl Into, + service: impl Into, + scope: impl Into, + refresh_token: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + grant_type: grant_type.into(), + service: service.into(), + scope: scope.into(), + refresh_token: refresh_token.into(), + } + } + } + pub mod get_from_login { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AcrErrors, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) service: String, + pub(crate) scope: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/oauth2/token", 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())); + let service = &self.service; + url.query_pairs_mut().append_pair("service", service); + let scope = &self.scope; + url.query_pairs_mut().append_pair("scope", scope); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AccessToken = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AcrErrors = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::AcrErrors, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) grant_type: String, + pub(crate) service: String, + pub(crate) scope: String, + pub(crate) refresh_token: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/oauth2/token", 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())); + unimplemented!("form data not yet supported"); + unimplemented!("form data not yet supported"); + unimplemented!("form data not yet supported"); + unimplemented!("form data not yet supported"); + 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::AccessToken = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AcrErrors = + 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/svc/cosmosdb/README.md b/services/svc/cosmosdb/README.md index 5f08ab2321..57cfc47bd1 100644 --- a/services/svc/cosmosdb/README.md +++ b/services/svc/cosmosdb/README.md @@ -10,4 +10,4 @@ The default tag is `package-2019-02`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: -- `package-2019-02` has 3 operations from 1 API versions: `2019-02-02`. Use crate feature `package-2019-02` to enable. The operations will be in the `package_2019_02` module. \ No newline at end of file +- `package-2019-02` has 14 operations from 1 API versions: `2019-02-02`. Use crate feature `package-2019-02` to enable. The operations will be in the `package_2019_02` module. \ No newline at end of file diff --git a/services/svc/cosmosdb/src/package_2019_02/operations.rs b/services/svc/cosmosdb/src/package_2019_02/operations.rs index e111869cd9..bcd0c3952d 100644 --- a/services/svc/cosmosdb/src/package_2019_02/operations.rs +++ b/services/svc/cosmosdb/src/package_2019_02/operations.rs @@ -77,6 +77,9 @@ impl Client { pub fn service(&self) -> service::Client { service::Client(self.clone()) } + pub fn table(&self) -> table::Client { + table::Client(self.clone()) + } } #[non_exhaustive] #[derive(Debug, thiserror :: Error)] @@ -88,6 +91,28 @@ pub enum Error { Service_SetProperties(#[from] service::set_properties::Error), #[error(transparent)] Service_GetStatistics(#[from] service::get_statistics::Error), + #[error(transparent)] + Table_Query(#[from] table::query::Error), + #[error(transparent)] + Table_Create(#[from] table::create::Error), + #[error(transparent)] + Table_Delete(#[from] table::delete::Error), + #[error(transparent)] + Table_QueryEntities(#[from] table::query_entities::Error), + #[error(transparent)] + Table_QueryEntityWithPartitionAndRowKey(#[from] table::query_entity_with_partition_and_row_key::Error), + #[error(transparent)] + Table_UpdateEntity(#[from] table::update_entity::Error), + #[error(transparent)] + Table_MergeEntity(#[from] table::merge_entity::Error), + #[error(transparent)] + Table_DeleteEntity(#[from] table::delete_entity::Error), + #[error(transparent)] + Table_GetAccessPolicy(#[from] table::get_access_policy::Error), + #[error(transparent)] + Table_InsertEntity(#[from] table::insert_entity::Error), + #[error(transparent)] + Table_SetAccessPolicy(#[from] table::set_access_policy::Error), } pub mod service { use super::models; @@ -412,3 +437,1388 @@ pub mod service { } } } +pub mod table { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn query(&self, x_ms_version: impl Into, data_service_version: impl Into) -> query::Builder { + query::Builder { + client: self.0.clone(), + x_ms_version: x_ms_version.into(), + data_service_version: data_service_version.into(), + x_ms_client_request_id: None, + format: None, + top: None, + select: None, + filter: None, + next_table_name: None, + } + } + pub fn create( + &self, + x_ms_version: impl Into, + data_service_version: impl Into, + table_properties: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + x_ms_version: x_ms_version.into(), + data_service_version: data_service_version.into(), + table_properties: table_properties.into(), + x_ms_client_request_id: None, + format: None, + prefer: None, + } + } + pub fn delete(&self, x_ms_version: impl Into, table: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + x_ms_version: x_ms_version.into(), + table: table.into(), + x_ms_client_request_id: None, + } + } + pub fn query_entities( + &self, + x_ms_version: impl Into, + data_service_version: impl Into, + table: impl Into, + ) -> query_entities::Builder { + query_entities::Builder { + client: self.0.clone(), + x_ms_version: x_ms_version.into(), + data_service_version: data_service_version.into(), + table: table.into(), + timeout: None, + x_ms_client_request_id: None, + format: None, + top: None, + select: None, + filter: None, + next_partition_key: None, + next_row_key: None, + } + } + pub fn query_entity_with_partition_and_row_key( + &self, + x_ms_version: impl Into, + data_service_version: impl Into, + table: impl Into, + partition_key: impl Into, + row_key: impl Into, + ) -> query_entity_with_partition_and_row_key::Builder { + query_entity_with_partition_and_row_key::Builder { + client: self.0.clone(), + x_ms_version: x_ms_version.into(), + data_service_version: data_service_version.into(), + table: table.into(), + partition_key: partition_key.into(), + row_key: row_key.into(), + timeout: None, + x_ms_client_request_id: None, + format: None, + select: None, + filter: None, + } + } + pub fn update_entity( + &self, + x_ms_version: impl Into, + data_service_version: impl Into, + table: impl Into, + partition_key: impl Into, + row_key: impl Into, + ) -> update_entity::Builder { + update_entity::Builder { + client: self.0.clone(), + x_ms_version: x_ms_version.into(), + data_service_version: data_service_version.into(), + table: table.into(), + partition_key: partition_key.into(), + row_key: row_key.into(), + timeout: None, + x_ms_client_request_id: None, + format: None, + table_entity_properties: None, + if_match: None, + } + } + pub fn merge_entity( + &self, + x_ms_version: impl Into, + data_service_version: impl Into, + table: impl Into, + partition_key: impl Into, + row_key: impl Into, + ) -> merge_entity::Builder { + merge_entity::Builder { + client: self.0.clone(), + x_ms_version: x_ms_version.into(), + data_service_version: data_service_version.into(), + table: table.into(), + partition_key: partition_key.into(), + row_key: row_key.into(), + timeout: None, + x_ms_client_request_id: None, + format: None, + table_entity_properties: None, + if_match: None, + } + } + pub fn delete_entity( + &self, + x_ms_version: impl Into, + data_service_version: impl Into, + table: impl Into, + partition_key: impl Into, + row_key: impl Into, + if_match: impl Into, + ) -> delete_entity::Builder { + delete_entity::Builder { + client: self.0.clone(), + x_ms_version: x_ms_version.into(), + data_service_version: data_service_version.into(), + table: table.into(), + partition_key: partition_key.into(), + row_key: row_key.into(), + if_match: if_match.into(), + timeout: None, + x_ms_client_request_id: None, + format: None, + } + } + pub fn get_access_policy( + &self, + x_ms_version: impl Into, + table: impl Into, + comp: impl Into, + ) -> get_access_policy::Builder { + get_access_policy::Builder { + client: self.0.clone(), + x_ms_version: x_ms_version.into(), + table: table.into(), + comp: comp.into(), + timeout: None, + x_ms_client_request_id: None, + } + } + pub fn insert_entity( + &self, + x_ms_version: impl Into, + data_service_version: impl Into, + table: impl Into, + ) -> insert_entity::Builder { + insert_entity::Builder { + client: self.0.clone(), + x_ms_version: x_ms_version.into(), + data_service_version: data_service_version.into(), + table: table.into(), + timeout: None, + x_ms_client_request_id: None, + format: None, + table_entity_properties: None, + prefer: None, + } + } + pub fn set_access_policy( + &self, + x_ms_version: impl Into, + table: impl Into, + comp: impl Into, + ) -> set_access_policy::Builder { + set_access_policy::Builder { + client: self.0.clone(), + x_ms_version: x_ms_version.into(), + table: table.into(), + comp: comp.into(), + table_acl: None, + timeout: None, + x_ms_client_request_id: None, + } + } + } + pub mod query { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) x_ms_version: String, + pub(crate) data_service_version: String, + pub(crate) x_ms_client_request_id: Option, + pub(crate) format: Option, + pub(crate) top: Option, + pub(crate) select: Option, + pub(crate) filter: Option, + pub(crate) next_table_name: Option, + } + impl Builder { + pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into) -> Self { + self.x_ms_client_request_id = Some(x_ms_client_request_id.into()); + self + } + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn next_table_name(mut self, next_table_name: impl Into) -> Self { + self.next_table_name = Some(next_table_name.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/Tables", 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())); + req_builder = req_builder.header("x-ms-version", &self.x_ms_version); + if let Some(x_ms_client_request_id) = &self.x_ms_client_request_id { + req_builder = req_builder.header("x-ms-client-request-id", x_ms_client_request_id); + } + req_builder = req_builder.header("DataServiceVersion", &self.data_service_version); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("$format", format); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(next_table_name) = &self.next_table_name { + url.query_pairs_mut().append_pair("NextTableName", next_table_name); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TableQueryResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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; + #[derive(Debug)] + pub enum Response { + Created201(models::TableResponse), + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::TableServiceError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) x_ms_version: String, + pub(crate) data_service_version: String, + pub(crate) table_properties: models::TableProperties, + pub(crate) x_ms_client_request_id: Option, + pub(crate) format: Option, + pub(crate) prefer: Option, + } + impl Builder { + pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into) -> Self { + self.x_ms_client_request_id = Some(x_ms_client_request_id.into()); + self + } + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.into()); + self + } + pub fn prefer(mut self, prefer: impl Into) -> Self { + self.prefer = Some(prefer.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/Tables", 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())); + req_builder = req_builder.header("x-ms-version", &self.x_ms_version); + if let Some(x_ms_client_request_id) = &self.x_ms_client_request_id { + req_builder = req_builder.header("x-ms-client-request-id", x_ms_client_request_id); + } + req_builder = req_builder.header("DataServiceVersion", &self.data_service_version); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("$format", format); + } + req_builder = req_builder.header("content-type", "application/json;odata=nometadata"); + let req_body = azure_core::to_json(&self.table_properties).map_err(Error::Serialize)?; + if let Some(prefer) = &self.prefer { + req_builder = req_builder.header("Prefer", prefer); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TableResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(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::TableServiceError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::TableServiceError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) x_ms_version: String, + pub(crate) table: String, + pub(crate) x_ms_client_request_id: Option, + } + impl Builder { + pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into) -> Self { + self.x_ms_client_request_id = Some(x_ms_client_request_id.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/Tables('{}')", self.client.endpoint(), &self.table); + let mut url = 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())); + req_builder = req_builder.header("x-ms-version", &self.x_ms_version); + if let Some(x_ms_client_request_id) = &self.x_ms_client_request_id { + req_builder = req_builder.header("x-ms-client-request-id", x_ms_client_request_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::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TableServiceError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod query_entities { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::TableServiceError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) x_ms_version: String, + pub(crate) data_service_version: String, + pub(crate) table: String, + pub(crate) timeout: Option, + pub(crate) x_ms_client_request_id: Option, + pub(crate) format: Option, + pub(crate) top: Option, + pub(crate) select: Option, + pub(crate) filter: Option, + pub(crate) next_partition_key: Option, + pub(crate) next_row_key: Option, + } + impl Builder { + pub fn timeout(mut self, timeout: i64) -> Self { + self.timeout = Some(timeout); + self + } + pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into) -> Self { + self.x_ms_client_request_id = Some(x_ms_client_request_id.into()); + self + } + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn next_partition_key(mut self, next_partition_key: impl Into) -> Self { + self.next_partition_key = Some(next_partition_key.into()); + self + } + pub fn next_row_key(mut self, next_row_key: impl Into) -> Self { + self.next_row_key = Some(next_row_key.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/{}()", self.client.endpoint(), &self.table); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(timeout) = &self.timeout { + url.query_pairs_mut().append_pair("timeout", &timeout.to_string()); + } + req_builder = req_builder.header("x-ms-version", &self.x_ms_version); + if let Some(x_ms_client_request_id) = &self.x_ms_client_request_id { + req_builder = req_builder.header("x-ms-client-request-id", x_ms_client_request_id); + } + req_builder = req_builder.header("DataServiceVersion", &self.data_service_version); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("$format", format); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(next_partition_key) = &self.next_partition_key { + url.query_pairs_mut().append_pair("NextPartitionKey", next_partition_key); + } + if let Some(next_row_key) = &self.next_row_key { + url.query_pairs_mut().append_pair("NextRowKey", next_row_key); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TableEntityQueryResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TableServiceError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod query_entity_with_partition_and_row_key { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::TableServiceError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) x_ms_version: String, + pub(crate) data_service_version: String, + pub(crate) table: String, + pub(crate) partition_key: String, + pub(crate) row_key: String, + pub(crate) timeout: Option, + pub(crate) x_ms_client_request_id: Option, + pub(crate) format: Option, + pub(crate) select: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn timeout(mut self, timeout: i64) -> Self { + self.timeout = Some(timeout); + self + } + pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into) -> Self { + self.x_ms_client_request_id = Some(x_ms_client_request_id.into()); + self + } + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.into()); + self + } + pub fn select(mut self, select: impl Into) -> Self { + self.select = Some(select.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!( + "{}/{}(PartitionKey='{}',RowKey='{}')", + self.client.endpoint(), + &self.table, + &self.partition_key, + &self.row_key + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(timeout) = &self.timeout { + url.query_pairs_mut().append_pair("timeout", &timeout.to_string()); + } + req_builder = req_builder.header("x-ms-version", &self.x_ms_version); + if let Some(x_ms_client_request_id) = &self.x_ms_client_request_id { + req_builder = req_builder.header("x-ms-client-request-id", x_ms_client_request_id); + } + req_builder = req_builder.header("DataServiceVersion", &self.data_service_version); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("$format", format); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + 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::TableEntityProperties = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TableServiceError = + serde_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_entity { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::TableServiceError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) x_ms_version: String, + pub(crate) data_service_version: String, + pub(crate) table: String, + pub(crate) partition_key: String, + pub(crate) row_key: String, + pub(crate) timeout: Option, + pub(crate) x_ms_client_request_id: Option, + pub(crate) format: Option, + pub(crate) table_entity_properties: Option, + pub(crate) if_match: Option, + } + impl Builder { + pub fn timeout(mut self, timeout: i64) -> Self { + self.timeout = Some(timeout); + self + } + pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into) -> Self { + self.x_ms_client_request_id = Some(x_ms_client_request_id.into()); + self + } + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.into()); + self + } + pub fn table_entity_properties(mut self, table_entity_properties: impl Into) -> Self { + self.table_entity_properties = Some(table_entity_properties.into()); + self + } + 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<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/{}(PartitionKey='{}',RowKey='{}')", + self.client.endpoint(), + &self.table, + &self.partition_key, + &self.row_key + ); + let mut url = 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())); + if let Some(timeout) = &self.timeout { + url.query_pairs_mut().append_pair("timeout", &timeout.to_string()); + } + req_builder = req_builder.header("x-ms-version", &self.x_ms_version); + if let Some(x_ms_client_request_id) = &self.x_ms_client_request_id { + req_builder = req_builder.header("x-ms-client-request-id", x_ms_client_request_id); + } + req_builder = req_builder.header("DataServiceVersion", &self.data_service_version); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("$format", format); + } + let req_body = if let Some(table_entity_properties) = &self.table_entity_properties { + req_builder = req_builder.header("content-type", "application/json;odata=nometadata"); + azure_core::to_json(table_entity_properties).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + 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::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TableServiceError = + serde_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_entity { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::TableServiceError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) x_ms_version: String, + pub(crate) data_service_version: String, + pub(crate) table: String, + pub(crate) partition_key: String, + pub(crate) row_key: String, + pub(crate) timeout: Option, + pub(crate) x_ms_client_request_id: Option, + pub(crate) format: Option, + pub(crate) table_entity_properties: Option, + pub(crate) if_match: Option, + } + impl Builder { + pub fn timeout(mut self, timeout: i64) -> Self { + self.timeout = Some(timeout); + self + } + pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into) -> Self { + self.x_ms_client_request_id = Some(x_ms_client_request_id.into()); + self + } + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.into()); + self + } + pub fn table_entity_properties(mut self, table_entity_properties: impl Into) -> Self { + self.table_entity_properties = Some(table_entity_properties.into()); + self + } + 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<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/{}(PartitionKey='{}',RowKey='{}')", + self.client.endpoint(), + &self.table, + &self.partition_key, + &self.row_key + ); + let mut url = 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())); + if let Some(timeout) = &self.timeout { + url.query_pairs_mut().append_pair("timeout", &timeout.to_string()); + } + req_builder = req_builder.header("x-ms-version", &self.x_ms_version); + if let Some(x_ms_client_request_id) = &self.x_ms_client_request_id { + req_builder = req_builder.header("x-ms-client-request-id", x_ms_client_request_id); + } + req_builder = req_builder.header("DataServiceVersion", &self.data_service_version); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("$format", format); + } + let req_body = if let Some(table_entity_properties) = &self.table_entity_properties { + req_builder = req_builder.header("content-type", "application/json;odata=nometadata"); + azure_core::to_json(table_entity_properties).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + 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::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TableServiceError = + serde_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_entity { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::TableServiceError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) x_ms_version: String, + pub(crate) data_service_version: String, + pub(crate) table: String, + pub(crate) partition_key: String, + pub(crate) row_key: String, + pub(crate) if_match: String, + pub(crate) timeout: Option, + pub(crate) x_ms_client_request_id: Option, + pub(crate) format: Option, + } + impl Builder { + pub fn timeout(mut self, timeout: i64) -> Self { + self.timeout = Some(timeout); + self + } + pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into) -> Self { + self.x_ms_client_request_id = Some(x_ms_client_request_id.into()); + self + } + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/{}(PartitionKey='{}',RowKey='{}')", + self.client.endpoint(), + &self.table, + &self.partition_key, + &self.row_key + ); + let mut url = 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())); + if let Some(timeout) = &self.timeout { + url.query_pairs_mut().append_pair("timeout", &timeout.to_string()); + } + req_builder = req_builder.header("x-ms-version", &self.x_ms_version); + if let Some(x_ms_client_request_id) = &self.x_ms_client_request_id { + req_builder = req_builder.header("x-ms-client-request-id", x_ms_client_request_id); + } + req_builder = req_builder.header("DataServiceVersion", &self.data_service_version); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("$format", format); + } + 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::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TableServiceError = + serde_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_policy { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::TableServiceError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) x_ms_version: String, + pub(crate) table: String, + pub(crate) comp: String, + pub(crate) timeout: Option, + pub(crate) x_ms_client_request_id: Option, + } + impl Builder { + pub fn timeout(mut self, timeout: i64) -> Self { + self.timeout = Some(timeout); + self + } + pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into) -> Self { + self.x_ms_client_request_id = Some(x_ms_client_request_id.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/{}", self.client.endpoint(), &self.table); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(timeout) = &self.timeout { + url.query_pairs_mut().append_pair("timeout", &timeout.to_string()); + } + req_builder = req_builder.header("x-ms-version", &self.x_ms_version); + if let Some(x_ms_client_request_id) = &self.x_ms_client_request_id { + req_builder = req_builder.header("x-ms-client-request-id", x_ms_client_request_id); + } + let comp = &self.comp; + url.query_pairs_mut().append_pair("comp", comp); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SignedIdentifiers = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TableServiceError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod insert_entity { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TableEntityProperties), + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::TableServiceError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) x_ms_version: String, + pub(crate) data_service_version: String, + pub(crate) table: String, + pub(crate) timeout: Option, + pub(crate) x_ms_client_request_id: Option, + pub(crate) format: Option, + pub(crate) table_entity_properties: Option, + pub(crate) prefer: Option, + } + impl Builder { + pub fn timeout(mut self, timeout: i64) -> Self { + self.timeout = Some(timeout); + self + } + pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into) -> Self { + self.x_ms_client_request_id = Some(x_ms_client_request_id.into()); + self + } + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.into()); + self + } + pub fn table_entity_properties(mut self, table_entity_properties: impl Into) -> Self { + self.table_entity_properties = Some(table_entity_properties.into()); + self + } + pub fn prefer(mut self, prefer: impl Into) -> Self { + self.prefer = Some(prefer.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/{}", self.client.endpoint(), &self.table); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(timeout) = &self.timeout { + url.query_pairs_mut().append_pair("timeout", &timeout.to_string()); + } + req_builder = req_builder.header("x-ms-version", &self.x_ms_version); + if let Some(x_ms_client_request_id) = &self.x_ms_client_request_id { + req_builder = req_builder.header("x-ms-client-request-id", x_ms_client_request_id); + } + req_builder = req_builder.header("DataServiceVersion", &self.data_service_version); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("$format", format); + } + let req_body = if let Some(table_entity_properties) = &self.table_entity_properties { + req_builder = req_builder.header("content-type", "application/json;odata=nometadata"); + azure_core::to_json(table_entity_properties).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + if let Some(prefer) = &self.prefer { + req_builder = req_builder.header("Prefer", prefer); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TableEntityProperties = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(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::TableServiceError = + serde_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_access_policy { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::TableServiceError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) x_ms_version: String, + pub(crate) table: String, + pub(crate) comp: String, + pub(crate) table_acl: Option, + pub(crate) timeout: Option, + pub(crate) x_ms_client_request_id: Option, + } + impl Builder { + pub fn table_acl(mut self, table_acl: impl Into) -> Self { + self.table_acl = Some(table_acl.into()); + self + } + pub fn timeout(mut self, timeout: i64) -> Self { + self.timeout = Some(timeout); + self + } + pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into) -> Self { + self.x_ms_client_request_id = Some(x_ms_client_request_id.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/{}", self.client.endpoint(), &self.table); + let mut url = 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(table_acl) = &self.table_acl { + req_builder = req_builder.header("content-type", "application/json;odata=nometadata"); + azure_core::to_json(table_acl).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + if let Some(timeout) = &self.timeout { + url.query_pairs_mut().append_pair("timeout", &timeout.to_string()); + } + req_builder = req_builder.header("x-ms-version", &self.x_ms_version); + if let Some(x_ms_client_request_id) = &self.x_ms_client_request_id { + req_builder = req_builder.header("x-ms-client-request-id", x_ms_client_request_id); + } + let comp = &self.comp; + url.query_pairs_mut().append_pair("comp", comp); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TableServiceError = + 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/svc/datalakeanalytics/README.md b/services/svc/datalakeanalytics/README.md index 94fbf2343b..3033231b45 100644 --- a/services/svc/datalakeanalytics/README.md +++ b/services/svc/datalakeanalytics/README.md @@ -10,7 +10,7 @@ The default tag is `package-catalog-2016-11`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: -- `package-catalog-2016-11` has 4 operations from 1 API versions: `2016-11-01`. Use crate feature `package-catalog-2016-11` to enable. The operations will be in the `package_catalog_2016_11` module. +- `package-catalog-2016-11` has 49 operations from 1 API versions: `2016-11-01`. Use crate feature `package-catalog-2016-11` to enable. The operations will be in the `package_catalog_2016_11` module. - `package-catalog-2015-10-preview` has 30 operations from 1 API versions: `2015-10-01-preview`. Use crate feature `package-catalog-2015-10-preview` to enable. The operations will be in the `package_catalog_2015_10_preview` module. - `package-job-2017-09-preview` has 13 operations from 1 API versions: `2017-09-01-preview`. Use crate feature `package-job-2017-09-preview` to enable. The operations will be in the `package_job_2017_09_preview` module. - `package-job-2016-11` has 11 operations from 1 API versions: `2016-11-01`. Use crate feature `package-job-2016-11` to enable. The operations will be in the `package_job_2016_11` module. diff --git a/services/svc/datalakeanalytics/src/package_catalog_2016_11/operations.rs b/services/svc/datalakeanalytics/src/package_catalog_2016_11/operations.rs index a8713ee53c..d5517f7a1b 100644 --- a/services/svc/datalakeanalytics/src/package_catalog_2016_11/operations.rs +++ b/services/svc/datalakeanalytics/src/package_catalog_2016_11/operations.rs @@ -90,6 +90,96 @@ pub enum Error { Catalog_RevokeAcl(#[from] catalog::revoke_acl::Error), #[error(transparent)] Catalog_RevokeAclFromDatabase(#[from] catalog::revoke_acl_from_database::Error), + #[error(transparent)] + Catalog_GetSecret(#[from] catalog::get_secret::Error), + #[error(transparent)] + Catalog_CreateSecret(#[from] catalog::create_secret::Error), + #[error(transparent)] + Catalog_UpdateSecret(#[from] catalog::update_secret::Error), + #[error(transparent)] + Catalog_DeleteSecret(#[from] catalog::delete_secret::Error), + #[error(transparent)] + Catalog_DeleteAllSecrets(#[from] catalog::delete_all_secrets::Error), + #[error(transparent)] + Catalog_GetCredential(#[from] catalog::get_credential::Error), + #[error(transparent)] + Catalog_DeleteCredential(#[from] catalog::delete_credential::Error), + #[error(transparent)] + Catalog_CreateCredential(#[from] catalog::create_credential::Error), + #[error(transparent)] + Catalog_UpdateCredential(#[from] catalog::update_credential::Error), + #[error(transparent)] + Catalog_ListCredentials(#[from] catalog::list_credentials::Error), + #[error(transparent)] + Catalog_GetExternalDataSource(#[from] catalog::get_external_data_source::Error), + #[error(transparent)] + Catalog_ListExternalDataSources(#[from] catalog::list_external_data_sources::Error), + #[error(transparent)] + Catalog_GetProcedure(#[from] catalog::get_procedure::Error), + #[error(transparent)] + Catalog_ListProcedures(#[from] catalog::list_procedures::Error), + #[error(transparent)] + Catalog_GetTable(#[from] catalog::get_table::Error), + #[error(transparent)] + Catalog_ListTableFragments(#[from] catalog::list_table_fragments::Error), + #[error(transparent)] + Catalog_ListTables(#[from] catalog::list_tables::Error), + #[error(transparent)] + Catalog_ListTableStatisticsByDatabaseAndSchema(#[from] catalog::list_table_statistics_by_database_and_schema::Error), + #[error(transparent)] + Catalog_GetTableType(#[from] catalog::get_table_type::Error), + #[error(transparent)] + Catalog_ListTableTypes(#[from] catalog::list_table_types::Error), + #[error(transparent)] + Catalog_GetPackage(#[from] catalog::get_package::Error), + #[error(transparent)] + Catalog_ListPackages(#[from] catalog::list_packages::Error), + #[error(transparent)] + Catalog_GetView(#[from] catalog::get_view::Error), + #[error(transparent)] + Catalog_ListViews(#[from] catalog::list_views::Error), + #[error(transparent)] + Catalog_GetTableStatistic(#[from] catalog::get_table_statistic::Error), + #[error(transparent)] + Catalog_ListTableStatistics(#[from] catalog::list_table_statistics::Error), + #[error(transparent)] + Catalog_PreviewTablePartition(#[from] catalog::preview_table_partition::Error), + #[error(transparent)] + Catalog_GetTablePartition(#[from] catalog::get_table_partition::Error), + #[error(transparent)] + Catalog_PreviewTable(#[from] catalog::preview_table::Error), + #[error(transparent)] + Catalog_ListTablePartitions(#[from] catalog::list_table_partitions::Error), + #[error(transparent)] + Catalog_ListTypes(#[from] catalog::list_types::Error), + #[error(transparent)] + Catalog_GetTableValuedFunction(#[from] catalog::get_table_valued_function::Error), + #[error(transparent)] + Catalog_ListTableValuedFunctions(#[from] catalog::list_table_valued_functions::Error), + #[error(transparent)] + Catalog_GetAssembly(#[from] catalog::get_assembly::Error), + #[error(transparent)] + Catalog_ListAssemblies(#[from] catalog::list_assemblies::Error), + #[error(transparent)] + Catalog_GetSchema(#[from] catalog::get_schema::Error), + #[error(transparent)] + Catalog_ListSchemas(#[from] catalog::list_schemas::Error), + #[error(transparent)] + Catalog_ListTableStatisticsByDatabase(#[from] catalog::list_table_statistics_by_database::Error), + #[error(transparent)] + Catalog_ListTablesByDatabase(#[from] catalog::list_tables_by_database::Error), + #[error(transparent)] + Catalog_ListTableValuedFunctionsByDatabase(#[from] catalog::list_table_valued_functions_by_database::Error), + #[error(transparent)] + Catalog_ListViewsByDatabase(#[from] catalog::list_views_by_database::Error), + #[error(transparent)] + Catalog_ListAclsByDatabase(#[from] catalog::list_acls_by_database::Error), + #[error(transparent)] + Catalog_ListAcls(#[from] catalog::list_acls::Error), + #[error(transparent)] + Catalog_GetDatabase(#[from] catalog::get_database::Error), + #[error(transparent)] + Catalog_ListDatabases(#[from] catalog::list_databases::Error), } pub mod catalog { use super::models; @@ -115,28 +205,4570 @@ pub mod catalog { op: op.into(), } } - pub fn revoke_acl(&self, parameters: impl Into, op: impl Into) -> revoke_acl::Builder { - revoke_acl::Builder { - client: self.0.clone(), - parameters: parameters.into(), - op: op.into(), - } + pub fn revoke_acl(&self, parameters: impl Into, op: impl Into) -> revoke_acl::Builder { + revoke_acl::Builder { + client: self.0.clone(), + parameters: parameters.into(), + op: op.into(), + } + } + pub fn revoke_acl_from_database( + &self, + database_name: impl Into, + parameters: impl Into, + op: impl Into, + ) -> revoke_acl_from_database::Builder { + revoke_acl_from_database::Builder { + client: self.0.clone(), + database_name: database_name.into(), + parameters: parameters.into(), + op: op.into(), + } + } + pub fn get_secret(&self, database_name: impl Into, secret_name: impl Into) -> get_secret::Builder { + get_secret::Builder { + client: self.0.clone(), + database_name: database_name.into(), + secret_name: secret_name.into(), + } + } + pub fn create_secret( + &self, + database_name: impl Into, + secret_name: impl Into, + parameters: impl Into, + ) -> create_secret::Builder { + create_secret::Builder { + client: self.0.clone(), + database_name: database_name.into(), + secret_name: secret_name.into(), + parameters: parameters.into(), + } + } + pub fn update_secret( + &self, + database_name: impl Into, + secret_name: impl Into, + parameters: impl Into, + ) -> update_secret::Builder { + update_secret::Builder { + client: self.0.clone(), + database_name: database_name.into(), + secret_name: secret_name.into(), + parameters: parameters.into(), + } + } + pub fn delete_secret(&self, database_name: impl Into, secret_name: impl Into) -> delete_secret::Builder { + delete_secret::Builder { + client: self.0.clone(), + database_name: database_name.into(), + secret_name: secret_name.into(), + } + } + pub fn delete_all_secrets(&self, database_name: impl Into) -> delete_all_secrets::Builder { + delete_all_secrets::Builder { + client: self.0.clone(), + database_name: database_name.into(), + } + } + pub fn get_credential(&self, database_name: impl Into, credential_name: impl Into) -> get_credential::Builder { + get_credential::Builder { + client: self.0.clone(), + database_name: database_name.into(), + credential_name: credential_name.into(), + } + } + pub fn delete_credential( + &self, + database_name: impl Into, + credential_name: impl Into, + ) -> delete_credential::Builder { + delete_credential::Builder { + client: self.0.clone(), + database_name: database_name.into(), + credential_name: credential_name.into(), + parameters: None, + cascade: None, + } + } + pub fn create_credential( + &self, + database_name: impl Into, + credential_name: impl Into, + parameters: impl Into, + ) -> create_credential::Builder { + create_credential::Builder { + client: self.0.clone(), + database_name: database_name.into(), + credential_name: credential_name.into(), + parameters: parameters.into(), + } + } + pub fn update_credential( + &self, + database_name: impl Into, + credential_name: impl Into, + parameters: impl Into, + ) -> update_credential::Builder { + update_credential::Builder { + client: self.0.clone(), + database_name: database_name.into(), + credential_name: credential_name.into(), + parameters: parameters.into(), + } + } + pub fn list_credentials(&self, database_name: impl Into) -> list_credentials::Builder { + list_credentials::Builder { + client: self.0.clone(), + database_name: database_name.into(), + filter: None, + top: None, + skip: None, + select: None, + orderby: None, + count: None, + } + } + pub fn get_external_data_source( + &self, + database_name: impl Into, + external_data_source_name: impl Into, + ) -> get_external_data_source::Builder { + get_external_data_source::Builder { + client: self.0.clone(), + database_name: database_name.into(), + external_data_source_name: external_data_source_name.into(), + } + } + pub fn list_external_data_sources(&self, database_name: impl Into) -> list_external_data_sources::Builder { + list_external_data_sources::Builder { + client: self.0.clone(), + database_name: database_name.into(), + filter: None, + top: None, + skip: None, + select: None, + orderby: None, + count: None, + } + } + pub fn get_procedure( + &self, + database_name: impl Into, + schema_name: impl Into, + procedure_name: impl Into, + ) -> get_procedure::Builder { + get_procedure::Builder { + client: self.0.clone(), + database_name: database_name.into(), + schema_name: schema_name.into(), + procedure_name: procedure_name.into(), + } + } + pub fn list_procedures(&self, database_name: impl Into, schema_name: impl Into) -> list_procedures::Builder { + list_procedures::Builder { + client: self.0.clone(), + database_name: database_name.into(), + schema_name: schema_name.into(), + filter: None, + top: None, + skip: None, + select: None, + orderby: None, + count: None, + } + } + pub fn get_table( + &self, + database_name: impl Into, + schema_name: impl Into, + table_name: impl Into, + ) -> get_table::Builder { + get_table::Builder { + client: self.0.clone(), + database_name: database_name.into(), + schema_name: schema_name.into(), + table_name: table_name.into(), + } + } + pub fn list_table_fragments( + &self, + database_name: impl Into, + schema_name: impl Into, + table_name: impl Into, + ) -> list_table_fragments::Builder { + list_table_fragments::Builder { + client: self.0.clone(), + database_name: database_name.into(), + schema_name: schema_name.into(), + table_name: table_name.into(), + filter: None, + top: None, + skip: None, + select: None, + orderby: None, + count: None, + } + } + pub fn list_tables(&self, database_name: impl Into, schema_name: impl Into) -> list_tables::Builder { + list_tables::Builder { + client: self.0.clone(), + database_name: database_name.into(), + schema_name: schema_name.into(), + filter: None, + top: None, + skip: None, + select: None, + orderby: None, + count: None, + basic: None, + } + } + pub fn list_table_statistics_by_database_and_schema( + &self, + database_name: impl Into, + schema_name: impl Into, + ) -> list_table_statistics_by_database_and_schema::Builder { + list_table_statistics_by_database_and_schema::Builder { + client: self.0.clone(), + database_name: database_name.into(), + schema_name: schema_name.into(), + filter: None, + top: None, + skip: None, + select: None, + orderby: None, + count: None, + } + } + pub fn get_table_type( + &self, + database_name: impl Into, + schema_name: impl Into, + table_type_name: impl Into, + ) -> get_table_type::Builder { + get_table_type::Builder { + client: self.0.clone(), + database_name: database_name.into(), + schema_name: schema_name.into(), + table_type_name: table_type_name.into(), + } + } + pub fn list_table_types(&self, database_name: impl Into, schema_name: impl Into) -> list_table_types::Builder { + list_table_types::Builder { + client: self.0.clone(), + database_name: database_name.into(), + schema_name: schema_name.into(), + filter: None, + top: None, + skip: None, + select: None, + orderby: None, + count: None, + } + } + pub fn get_package( + &self, + database_name: impl Into, + schema_name: impl Into, + package_name: impl Into, + ) -> get_package::Builder { + get_package::Builder { + client: self.0.clone(), + database_name: database_name.into(), + schema_name: schema_name.into(), + package_name: package_name.into(), + } + } + pub fn list_packages(&self, database_name: impl Into, schema_name: impl Into) -> list_packages::Builder { + list_packages::Builder { + client: self.0.clone(), + database_name: database_name.into(), + schema_name: schema_name.into(), + filter: None, + top: None, + skip: None, + select: None, + orderby: None, + count: None, + } + } + pub fn get_view( + &self, + database_name: impl Into, + schema_name: impl Into, + view_name: impl Into, + ) -> get_view::Builder { + get_view::Builder { + client: self.0.clone(), + database_name: database_name.into(), + schema_name: schema_name.into(), + view_name: view_name.into(), + } + } + pub fn list_views(&self, database_name: impl Into, schema_name: impl Into) -> list_views::Builder { + list_views::Builder { + client: self.0.clone(), + database_name: database_name.into(), + schema_name: schema_name.into(), + filter: None, + top: None, + skip: None, + select: None, + orderby: None, + count: None, + } + } + pub fn get_table_statistic( + &self, + database_name: impl Into, + schema_name: impl Into, + table_name: impl Into, + statistics_name: impl Into, + ) -> get_table_statistic::Builder { + get_table_statistic::Builder { + client: self.0.clone(), + database_name: database_name.into(), + schema_name: schema_name.into(), + table_name: table_name.into(), + statistics_name: statistics_name.into(), + } + } + pub fn list_table_statistics( + &self, + database_name: impl Into, + schema_name: impl Into, + table_name: impl Into, + ) -> list_table_statistics::Builder { + list_table_statistics::Builder { + client: self.0.clone(), + database_name: database_name.into(), + schema_name: schema_name.into(), + table_name: table_name.into(), + filter: None, + top: None, + skip: None, + select: None, + orderby: None, + count: None, + } + } + pub fn preview_table_partition( + &self, + database_name: impl Into, + schema_name: impl Into, + table_name: impl Into, + partition_name: impl Into, + ) -> preview_table_partition::Builder { + preview_table_partition::Builder { + client: self.0.clone(), + database_name: database_name.into(), + schema_name: schema_name.into(), + table_name: table_name.into(), + partition_name: partition_name.into(), + max_rows: None, + max_columns: None, + } + } + pub fn get_table_partition( + &self, + database_name: impl Into, + schema_name: impl Into, + table_name: impl Into, + partition_name: impl Into, + ) -> get_table_partition::Builder { + get_table_partition::Builder { + client: self.0.clone(), + database_name: database_name.into(), + schema_name: schema_name.into(), + table_name: table_name.into(), + partition_name: partition_name.into(), + } + } + pub fn preview_table( + &self, + database_name: impl Into, + schema_name: impl Into, + table_name: impl Into, + ) -> preview_table::Builder { + preview_table::Builder { + client: self.0.clone(), + database_name: database_name.into(), + schema_name: schema_name.into(), + table_name: table_name.into(), + max_rows: None, + max_columns: None, + } + } + pub fn list_table_partitions( + &self, + database_name: impl Into, + schema_name: impl Into, + table_name: impl Into, + ) -> list_table_partitions::Builder { + list_table_partitions::Builder { + client: self.0.clone(), + database_name: database_name.into(), + schema_name: schema_name.into(), + table_name: table_name.into(), + filter: None, + top: None, + skip: None, + select: None, + orderby: None, + count: None, + } + } + pub fn list_types(&self, database_name: impl Into, schema_name: impl Into) -> list_types::Builder { + list_types::Builder { + client: self.0.clone(), + database_name: database_name.into(), + schema_name: schema_name.into(), + filter: None, + top: None, + skip: None, + select: None, + orderby: None, + count: None, + } + } + pub fn get_table_valued_function( + &self, + database_name: impl Into, + schema_name: impl Into, + table_valued_function_name: impl Into, + ) -> get_table_valued_function::Builder { + get_table_valued_function::Builder { + client: self.0.clone(), + database_name: database_name.into(), + schema_name: schema_name.into(), + table_valued_function_name: table_valued_function_name.into(), + } + } + pub fn list_table_valued_functions( + &self, + database_name: impl Into, + schema_name: impl Into, + ) -> list_table_valued_functions::Builder { + list_table_valued_functions::Builder { + client: self.0.clone(), + database_name: database_name.into(), + schema_name: schema_name.into(), + filter: None, + top: None, + skip: None, + select: None, + orderby: None, + count: None, + } + } + pub fn get_assembly(&self, database_name: impl Into, assembly_name: impl Into) -> get_assembly::Builder { + get_assembly::Builder { + client: self.0.clone(), + database_name: database_name.into(), + assembly_name: assembly_name.into(), + } + } + pub fn list_assemblies(&self, database_name: impl Into) -> list_assemblies::Builder { + list_assemblies::Builder { + client: self.0.clone(), + database_name: database_name.into(), + filter: None, + top: None, + skip: None, + select: None, + orderby: None, + count: None, + } + } + pub fn get_schema(&self, database_name: impl Into, schema_name: impl Into) -> get_schema::Builder { + get_schema::Builder { + client: self.0.clone(), + database_name: database_name.into(), + schema_name: schema_name.into(), + } + } + pub fn list_schemas(&self, database_name: impl Into) -> list_schemas::Builder { + list_schemas::Builder { + client: self.0.clone(), + database_name: database_name.into(), + filter: None, + top: None, + skip: None, + select: None, + orderby: None, + count: None, + } + } + pub fn list_table_statistics_by_database(&self, database_name: impl Into) -> list_table_statistics_by_database::Builder { + list_table_statistics_by_database::Builder { + client: self.0.clone(), + database_name: database_name.into(), + filter: None, + top: None, + skip: None, + select: None, + orderby: None, + count: None, + } + } + pub fn list_tables_by_database(&self, database_name: impl Into) -> list_tables_by_database::Builder { + list_tables_by_database::Builder { + client: self.0.clone(), + database_name: database_name.into(), + filter: None, + top: None, + skip: None, + select: None, + orderby: None, + count: None, + basic: None, + } + } + pub fn list_table_valued_functions_by_database( + &self, + database_name: impl Into, + ) -> list_table_valued_functions_by_database::Builder { + list_table_valued_functions_by_database::Builder { + client: self.0.clone(), + database_name: database_name.into(), + filter: None, + top: None, + skip: None, + select: None, + orderby: None, + count: None, + } + } + pub fn list_views_by_database(&self, database_name: impl Into) -> list_views_by_database::Builder { + list_views_by_database::Builder { + client: self.0.clone(), + database_name: database_name.into(), + filter: None, + top: None, + skip: None, + select: None, + orderby: None, + count: None, + } + } + pub fn list_acls_by_database(&self, database_name: impl Into) -> list_acls_by_database::Builder { + list_acls_by_database::Builder { + client: self.0.clone(), + database_name: database_name.into(), + filter: None, + top: None, + skip: None, + select: None, + orderby: None, + count: None, + } + } + pub fn list_acls(&self) -> list_acls::Builder { + list_acls::Builder { + client: self.0.clone(), + filter: None, + top: None, + skip: None, + select: None, + orderby: None, + count: None, + } + } + pub fn get_database(&self, database_name: impl Into) -> get_database::Builder { + get_database::Builder { + client: self.0.clone(), + database_name: database_name.into(), + } + } + pub fn list_databases(&self) -> list_databases::Builder { + list_databases::Builder { + client: self.0.clone(), + filter: None, + top: None, + skip: None, + select: None, + orderby: None, + count: None, + } + } + } + pub mod grant_acl { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) parameters: models::AclCreateOrUpdateParameters, + pub(crate) op: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/catalog/usql/acl?op=GRANTACE", 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", "2016-11-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let op = &self.op; + url.query_pairs_mut().append_pair("op", op); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 grant_acl_to_database { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) parameters: models::AclCreateOrUpdateParameters, + pub(crate) op: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/acl?op=GRANTACE", + self.client.endpoint(), + &self.database_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let op = &self.op; + url.query_pairs_mut().append_pair("op", op); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 revoke_acl { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) parameters: models::AclDeleteParameters, + pub(crate) op: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/catalog/usql/acl?op=REVOKEACE", 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", "2016-11-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let op = &self.op; + url.query_pairs_mut().append_pair("op", op); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 revoke_acl_from_database { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) parameters: models::AclDeleteParameters, + pub(crate) op: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/acl?op=REVOKEACE", + self.client.endpoint(), + &self.database_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let op = &self.op; + url.query_pairs_mut().append_pair("op", op); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 get_secret { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) secret_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/secrets/{}", + self.client.endpoint(), + &self.database_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", "2016-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::USqlSecret = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_secret { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) secret_name: String, + pub(crate) parameters: models::DataLakeAnalyticsCatalogSecretCreateOrUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/secrets/{}", + self.client.endpoint(), + &self.database_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", "2016-11-01"); + 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 update_secret { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) secret_name: String, + pub(crate) parameters: models::DataLakeAnalyticsCatalogSecretCreateOrUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/secrets/{}", + self.client.endpoint(), + &self.database_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::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", "2016-11-01"); + 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 delete_secret { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) secret_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!( + "{}/catalog/usql/databases/{}/secrets/{}", + self.client.endpoint(), + &self.database_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", "2016-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 delete_all_secrets { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_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!("{}/catalog/usql/databases/{}/secrets", self.client.endpoint(), &self.database_name); + let mut url = 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", "2016-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 get_credential { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) credential_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/credentials/{}", + self.client.endpoint(), + &self.database_name, + &self.credential_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::USqlCredential = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_credential { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) credential_name: String, + pub(crate) parameters: Option, + pub(crate) cascade: Option, + } + impl Builder { + pub fn parameters(mut self, parameters: impl Into) -> Self { + self.parameters = Some(parameters.into()); + self + } + pub fn cascade(mut self, cascade: bool) -> Self { + self.cascade = Some(cascade); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/credentials/{}", + self.client.endpoint(), + &self.database_name, + &self.credential_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + 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 + }; + if let Some(cascade) = &self.cascade { + url.query_pairs_mut().append_pair("cascade", &cascade.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(()), + status_code => { + let 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_credential { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) credential_name: String, + pub(crate) parameters: models::DataLakeAnalyticsCatalogCredentialCreateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/credentials/{}", + self.client.endpoint(), + &self.database_name, + &self.credential_name + ); + let mut url = 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", "2016-11-01"); + 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 update_credential { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) credential_name: String, + pub(crate) parameters: models::DataLakeAnalyticsCatalogCredentialUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/credentials/{}", + self.client.endpoint(), + &self.database_name, + &self.credential_name + ); + let mut url = 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", "2016-11-01"); + 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 list_credentials { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) select: Option, + pub(crate) orderby: Option, + pub(crate) count: 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn count(mut self, count: bool) -> Self { + self.count = Some(count); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/credentials", + self.client.endpoint(), + &self.database_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + 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()); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + if let Some(count) = &self.count { + url.query_pairs_mut().append_pair("$count", &count.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::USqlCredentialList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_external_data_source { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) external_data_source_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/externaldatasources/{}", + self.client.endpoint(), + &self.database_name, + &self.external_data_source_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::USqlExternalDataSource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_external_data_sources { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) select: Option, + pub(crate) orderby: Option, + pub(crate) count: 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn count(mut self, count: bool) -> Self { + self.count = Some(count); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/externaldatasources", + self.client.endpoint(), + &self.database_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + 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()); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + if let Some(count) = &self.count { + url.query_pairs_mut().append_pair("$count", &count.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::USqlExternalDataSourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_procedure { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) schema_name: String, + pub(crate) procedure_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/schemas/{}/procedures/{}", + self.client.endpoint(), + &self.database_name, + &self.schema_name, + &self.procedure_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::USqlProcedure = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_procedures { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) schema_name: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) select: Option, + pub(crate) orderby: Option, + pub(crate) count: 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn count(mut self, count: bool) -> Self { + self.count = Some(count); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/schemas/{}/procedures", + self.client.endpoint(), + &self.database_name, + &self.schema_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + 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()); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + if let Some(count) = &self.count { + url.query_pairs_mut().append_pair("$count", &count.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::USqlProcedureList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_table { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) schema_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!( + "{}/catalog/usql/databases/{}/schemas/{}/tables/{}", + self.client.endpoint(), + &self.database_name, + &self.schema_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", "2016-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::USqlTable = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_table_fragments { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) schema_name: String, + pub(crate) table_name: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) select: Option, + pub(crate) orderby: Option, + pub(crate) count: 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn count(mut self, count: bool) -> Self { + self.count = Some(count); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/schemas/{}/tables/{}/tablefragments", + self.client.endpoint(), + &self.database_name, + &self.schema_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", "2016-11-01"); + 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()); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + if let Some(count) = &self.count { + url.query_pairs_mut().append_pair("$count", &count.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::USqlTableFragmentList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_tables { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) schema_name: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) select: Option, + pub(crate) orderby: Option, + pub(crate) count: Option, + pub(crate) basic: 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn count(mut self, count: bool) -> Self { + self.count = Some(count); + self + } + pub fn basic(mut self, basic: bool) -> Self { + self.basic = Some(basic); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/schemas/{}/tables", + self.client.endpoint(), + &self.database_name, + &self.schema_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + 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()); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + if let Some(count) = &self.count { + url.query_pairs_mut().append_pair("$count", &count.to_string()); + } + if let Some(basic) = &self.basic { + url.query_pairs_mut().append_pair("basic", &basic.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::USqlTableList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_table_statistics_by_database_and_schema { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) schema_name: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) select: Option, + pub(crate) orderby: Option, + pub(crate) count: 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn count(mut self, count: bool) -> Self { + self.count = Some(count); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/schemas/{}/statistics", + self.client.endpoint(), + &self.database_name, + &self.schema_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + 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()); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + if let Some(count) = &self.count { + url.query_pairs_mut().append_pair("$count", &count.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::USqlTableStatisticsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_table_type { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) schema_name: String, + pub(crate) table_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!( + "{}/catalog/usql/databases/{}/schemas/{}/tabletypes/{}", + self.client.endpoint(), + &self.database_name, + &self.schema_name, + &self.table_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", "2016-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::USqlTableType = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_table_types { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) schema_name: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) select: Option, + pub(crate) orderby: Option, + pub(crate) count: 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn count(mut self, count: bool) -> Self { + self.count = Some(count); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/schemas/{}/tabletypes", + self.client.endpoint(), + &self.database_name, + &self.schema_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + 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()); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + if let Some(count) = &self.count { + url.query_pairs_mut().append_pair("$count", &count.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::USqlTableTypeList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_package { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) schema_name: String, + pub(crate) package_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/schemas/{}/packages/{}", + self.client.endpoint(), + &self.database_name, + &self.schema_name, + &self.package_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::USqlPackage = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_packages { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) schema_name: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) select: Option, + pub(crate) orderby: Option, + pub(crate) count: 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn count(mut self, count: bool) -> Self { + self.count = Some(count); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/schemas/{}/packages", + self.client.endpoint(), + &self.database_name, + &self.schema_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + 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()); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + if let Some(count) = &self.count { + url.query_pairs_mut().append_pair("$count", &count.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::USqlPackageList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_view { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) schema_name: String, + pub(crate) view_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/schemas/{}/views/{}", + self.client.endpoint(), + &self.database_name, + &self.schema_name, + &self.view_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::USqlView = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_views { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) schema_name: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) select: Option, + pub(crate) orderby: Option, + pub(crate) count: 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn count(mut self, count: bool) -> Self { + self.count = Some(count); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/schemas/{}/views", + self.client.endpoint(), + &self.database_name, + &self.schema_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + 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()); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + if let Some(count) = &self.count { + url.query_pairs_mut().append_pair("$count", &count.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::USqlViewList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_table_statistic { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) schema_name: String, + pub(crate) table_name: String, + pub(crate) statistics_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/schemas/{}/tables/{}/statistics/{}", + self.client.endpoint(), + &self.database_name, + &self.schema_name, + &self.table_name, + &self.statistics_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::USqlTableStatistics = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_table_statistics { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) schema_name: String, + pub(crate) table_name: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) select: Option, + pub(crate) orderby: Option, + pub(crate) count: 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn count(mut self, count: bool) -> Self { + self.count = Some(count); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/schemas/{}/tables/{}/statistics", + self.client.endpoint(), + &self.database_name, + &self.schema_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", "2016-11-01"); + 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()); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + if let Some(count) = &self.count { + url.query_pairs_mut().append_pair("$count", &count.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::USqlTableStatisticsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod preview_table_partition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) schema_name: String, + pub(crate) table_name: String, + pub(crate) partition_name: String, + pub(crate) max_rows: Option, + pub(crate) max_columns: Option, + } + impl Builder { + pub fn max_rows(mut self, max_rows: i64) -> Self { + self.max_rows = Some(max_rows); + self + } + pub fn max_columns(mut self, max_columns: i64) -> Self { + self.max_columns = Some(max_columns); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/schemas/{}/tables/{}/partitions/{}/previewrows", + self.client.endpoint(), + &self.database_name, + &self.schema_name, + &self.table_name, + &self.partition_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + if let Some(max_rows) = &self.max_rows { + url.query_pairs_mut().append_pair("maxRows", &max_rows.to_string()); + } + if let Some(max_columns) = &self.max_columns { + url.query_pairs_mut().append_pair("maxColumns", &max_columns.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::USqlTablePreview = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_table_partition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) schema_name: String, + pub(crate) table_name: String, + pub(crate) partition_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/schemas/{}/tables/{}/partitions/{}", + self.client.endpoint(), + &self.database_name, + &self.schema_name, + &self.table_name, + &self.partition_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::USqlTablePartition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod preview_table { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) schema_name: String, + pub(crate) table_name: String, + pub(crate) max_rows: Option, + pub(crate) max_columns: Option, + } + impl Builder { + pub fn max_rows(mut self, max_rows: i64) -> Self { + self.max_rows = Some(max_rows); + self + } + pub fn max_columns(mut self, max_columns: i64) -> Self { + self.max_columns = Some(max_columns); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/schemas/{}/tables/{}/previewrows", + self.client.endpoint(), + &self.database_name, + &self.schema_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", "2016-11-01"); + if let Some(max_rows) = &self.max_rows { + url.query_pairs_mut().append_pair("maxRows", &max_rows.to_string()); + } + if let Some(max_columns) = &self.max_columns { + url.query_pairs_mut().append_pair("maxColumns", &max_columns.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::USqlTablePreview = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_table_partitions { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) schema_name: String, + pub(crate) table_name: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) select: Option, + pub(crate) orderby: Option, + pub(crate) count: 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn count(mut self, count: bool) -> Self { + self.count = Some(count); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/schemas/{}/tables/{}/partitions", + self.client.endpoint(), + &self.database_name, + &self.schema_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", "2016-11-01"); + 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()); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + if let Some(count) = &self.count { + url.query_pairs_mut().append_pair("$count", &count.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::USqlTablePartitionList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) schema_name: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) select: Option, + pub(crate) orderby: Option, + pub(crate) count: 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn count(mut self, count: bool) -> Self { + self.count = Some(count); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/schemas/{}/types", + self.client.endpoint(), + &self.database_name, + &self.schema_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + 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()); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + if let Some(count) = &self.count { + url.query_pairs_mut().append_pair("$count", &count.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::USqlTypeList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_table_valued_function { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) schema_name: String, + pub(crate) table_valued_function_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/schemas/{}/tablevaluedfunctions/{}", + self.client.endpoint(), + &self.database_name, + &self.schema_name, + &self.table_valued_function_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::USqlTableValuedFunction = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_table_valued_functions { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) schema_name: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) select: Option, + pub(crate) orderby: Option, + pub(crate) count: 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn count(mut self, count: bool) -> Self { + self.count = Some(count); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/schemas/{}/tablevaluedfunctions", + self.client.endpoint(), + &self.database_name, + &self.schema_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + 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()); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + if let Some(count) = &self.count { + url.query_pairs_mut().append_pair("$count", &count.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::USqlTableValuedFunctionList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_assembly { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) assembly_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/assemblies/{}", + self.client.endpoint(), + &self.database_name, + &self.assembly_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::USqlAssembly = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_assemblies { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) select: Option, + pub(crate) orderby: Option, + pub(crate) count: 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn count(mut self, count: bool) -> Self { + self.count = Some(count); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/assemblies", + self.client.endpoint(), + &self.database_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + 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()); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + if let Some(count) = &self.count { + url.query_pairs_mut().append_pair("$count", &count.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::USqlAssemblyList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_schema { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) schema_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/schemas/{}", + self.client.endpoint(), + &self.database_name, + &self.schema_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::USqlSchema = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_schemas { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) select: Option, + pub(crate) orderby: Option, + pub(crate) count: 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn count(mut self, count: bool) -> Self { + self.count = Some(count); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/catalog/usql/databases/{}/schemas", self.client.endpoint(), &self.database_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + 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()); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + if let Some(count) = &self.count { + url.query_pairs_mut().append_pair("$count", &count.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::USqlSchemaList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_table_statistics_by_database { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) select: Option, + pub(crate) orderby: Option, + pub(crate) count: 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn count(mut self, count: bool) -> Self { + self.count = Some(count); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/statistics", + self.client.endpoint(), + &self.database_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + 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()); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + if let Some(count) = &self.count { + url.query_pairs_mut().append_pair("$count", &count.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::USqlTableStatisticsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_tables_by_database { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) select: Option, + pub(crate) orderby: Option, + pub(crate) count: Option, + pub(crate) basic: 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn count(mut self, count: bool) -> Self { + self.count = Some(count); + self + } + pub fn basic(mut self, basic: bool) -> Self { + self.basic = Some(basic); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/catalog/usql/databases/{}/tables", self.client.endpoint(), &self.database_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + 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()); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + if let Some(count) = &self.count { + url.query_pairs_mut().append_pair("$count", &count.to_string()); + } + if let Some(basic) = &self.basic { + url.query_pairs_mut().append_pair("basic", &basic.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::USqlTableList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_table_valued_functions_by_database { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), } - pub fn revoke_acl_from_database( - &self, - database_name: impl Into, - parameters: impl Into, - op: impl Into, - ) -> revoke_acl_from_database::Builder { - revoke_acl_from_database::Builder { - client: self.0.clone(), - database_name: database_name.into(), - parameters: parameters.into(), - op: op.into(), + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) database_name: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) select: Option, + pub(crate) orderby: Option, + pub(crate) count: 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn count(mut self, count: bool) -> Self { + self.count = Some(count); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/catalog/usql/databases/{}/tablevaluedfunctions", + self.client.endpoint(), + &self.database_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2016-11-01"); + 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()); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + if let Some(count) = &self.count { + url.query_pairs_mut().append_pair("$count", &count.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::USqlTableValuedFunctionList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_acl { + pub mod list_views_by_database { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -160,16 +4792,45 @@ pub mod catalog { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) parameters: models::AclCreateOrUpdateParameters, - pub(crate) op: String, + pub(crate) database_name: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) select: Option, + pub(crate) orderby: Option, + pub(crate) count: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn count(mut self, count: bool) -> Self { + self.count = Some(count); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { - let url_str = &format!("{}/catalog/usql/acl?op=GRANTACE", self.client.endpoint(),); + let url_str = &format!("{}/catalog/usql/databases/{}/views", self.client.endpoint(), &self.database_name); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -177,16 +4838,36 @@ pub mod catalog { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2016-11-01"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - let op = &self.op; - url.query_pairs_mut().append_pair("op", op); + 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()); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + if let Some(count) = &self.count { + url.query_pairs_mut().append_pair("$count", &count.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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::USqlViewList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; Err(Error::UnexpectedResponse { @@ -199,7 +4880,7 @@ pub mod catalog { } } } - pub mod grant_acl_to_database { + pub mod list_acls_by_database { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -224,20 +4905,44 @@ pub mod catalog { pub struct Builder { pub(crate) client: super::super::Client, pub(crate) database_name: String, - pub(crate) parameters: models::AclCreateOrUpdateParameters, - pub(crate) op: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) select: Option, + pub(crate) orderby: Option, + pub(crate) count: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn count(mut self, count: bool) -> Self { + self.count = Some(count); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { - let url_str = &format!( - "{}/catalog/usql/databases/{}/acl?op=GRANTACE", - self.client.endpoint(), - &self.database_name - ); + let url_str = &format!("{}/catalog/usql/databases/{}/acl", self.client.endpoint(), &self.database_name); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -245,16 +4950,36 @@ pub mod catalog { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2016-11-01"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - let op = &self.op; - url.query_pairs_mut().append_pair("op", op); + 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()); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + if let Some(count) = &self.count { + url.query_pairs_mut().append_pair("$count", &count.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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AclList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; Err(Error::UnexpectedResponse { @@ -267,7 +4992,7 @@ pub mod catalog { } } } - pub mod revoke_acl { + pub mod list_acls { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -291,16 +5016,44 @@ pub mod catalog { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) parameters: models::AclDeleteParameters, - pub(crate) op: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) select: Option, + pub(crate) orderby: Option, + pub(crate) count: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn count(mut self, count: bool) -> Self { + self.count = Some(count); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { - let url_str = &format!("{}/catalog/usql/acl?op=REVOKEACE", self.client.endpoint(),); + let url_str = &format!("{}/catalog/usql/acl", 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); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -308,16 +5061,36 @@ pub mod catalog { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2016-11-01"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - let op = &self.op; - url.query_pairs_mut().append_pair("op", op); + 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()); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + if let Some(count) = &self.count { + url.query_pairs_mut().append_pair("$count", &count.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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AclList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; Err(Error::UnexpectedResponse { @@ -330,7 +5103,7 @@ pub mod catalog { } } } - pub mod revoke_acl_from_database { + pub mod get_database { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -355,20 +5128,14 @@ pub mod catalog { pub struct Builder { pub(crate) client: super::super::Client, pub(crate) database_name: String, - pub(crate) parameters: models::AclDeleteParameters, - pub(crate) op: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { - let url_str = &format!( - "{}/catalog/usql/databases/{}/acl?op=REVOKEACE", - self.client.endpoint(), - &self.database_name - ); + let url_str = &format!("{}/catalog/usql/databases/{}", self.client.endpoint(), &self.database_name); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -376,16 +5143,129 @@ pub mod catalog { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2016-11-01"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - let op = &self.op; - url.query_pairs_mut().append_pair("op", op); + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = 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(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::USqlDatabase = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_databases { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) select: Option, + pub(crate) orderby: Option, + pub(crate) count: 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 select(mut self, select: impl Into) -> Self { + self.select = Some(select.into()); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn count(mut self, count: bool) -> Self { + self.count = Some(count); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/catalog/usql/databases", 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", "2016-11-01"); + 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()); + } + if let Some(select) = &self.select { + url.query_pairs_mut().append_pair("$select", select); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + if let Some(count) = &self.count { + url.query_pairs_mut().append_pair("$count", &count.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::USqlDatabaseList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; Err(Error::UnexpectedResponse { diff --git a/services/svc/deviceupdate/README.md b/services/svc/deviceupdate/README.md index b9696a5f05..73dab75edf 100644 --- a/services/svc/deviceupdate/README.md +++ b/services/svc/deviceupdate/README.md @@ -10,5 +10,5 @@ The default tag is `package-2021-06-01-preview`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: -- `package-2020-09-01` has 2 operations from 1 API versions: `2020-09-01`. Use crate feature `package-2020-09-01` to enable. The operations will be in the `package_2020_09_01` module. -- `package-2021-06-01-preview` has 2 operations from 1 API versions: `2021-06-01-preview`. Use crate feature `package-2021-06-01-preview` to enable. The operations will be in the `package_2021_06_01_preview` module. \ No newline at end of file +- `package-2020-09-01` has 33 operations from 1 API versions: `2020-09-01`. Use crate feature `package-2020-09-01` to enable. The operations will be in the `package_2020_09_01` module. +- `package-2021-06-01-preview` has 41 operations from 1 API versions: `2021-06-01-preview`. Use crate feature `package-2021-06-01-preview` to enable. The operations will be in the `package_2021_06_01_preview` module. \ No newline at end of file diff --git a/services/svc/deviceupdate/src/package_2020_09_01/operations.rs b/services/svc/deviceupdate/src/package_2020_09_01/operations.rs index 73d683fee0..4a432de8bc 100644 --- a/services/svc/deviceupdate/src/package_2020_09_01/operations.rs +++ b/services/svc/deviceupdate/src/package_2020_09_01/operations.rs @@ -77,6 +77,12 @@ impl Client { pub fn deployments(&self) -> deployments::Client { deployments::Client(self.clone()) } + pub fn devices(&self) -> devices::Client { + devices::Client(self.clone()) + } + pub fn updates(&self) -> updates::Client { + updates::Client(self.clone()) + } } #[non_exhaustive] #[derive(Debug, thiserror :: Error)] @@ -86,6 +92,68 @@ pub enum Error { Deployments_CancelDeployment(#[from] deployments::cancel_deployment::Error), #[error(transparent)] Deployments_RetryDeployment(#[from] deployments::retry_deployment::Error), + #[error(transparent)] + Updates_ImportUpdate(#[from] updates::import_update::Error), + #[error(transparent)] + Updates_GetUpdate(#[from] updates::get_update::Error), + #[error(transparent)] + Updates_DeleteUpdate(#[from] updates::delete_update::Error), + #[error(transparent)] + Updates_GetProviders(#[from] updates::get_providers::Error), + #[error(transparent)] + Updates_GetNames(#[from] updates::get_names::Error), + #[error(transparent)] + Updates_GetVersions(#[from] updates::get_versions::Error), + #[error(transparent)] + Updates_GetFiles(#[from] updates::get_files::Error), + #[error(transparent)] + Updates_GetFile(#[from] updates::get_file::Error), + #[error(transparent)] + Updates_GetOperations(#[from] updates::get_operations::Error), + #[error(transparent)] + Updates_GetOperation(#[from] updates::get_operation::Error), + #[error(transparent)] + Devices_GetAllDeviceClasses(#[from] devices::get_all_device_classes::Error), + #[error(transparent)] + Devices_GetDeviceClass(#[from] devices::get_device_class::Error), + #[error(transparent)] + Devices_GetDeviceClassDeviceIds(#[from] devices::get_device_class_device_ids::Error), + #[error(transparent)] + Devices_GetDeviceClassInstallableUpdates(#[from] devices::get_device_class_installable_updates::Error), + #[error(transparent)] + Devices_GetAllDevices(#[from] devices::get_all_devices::Error), + #[error(transparent)] + Devices_GetDevice(#[from] devices::get_device::Error), + #[error(transparent)] + Devices_GetUpdateCompliance(#[from] devices::get_update_compliance::Error), + #[error(transparent)] + Devices_GetAllDeviceTags(#[from] devices::get_all_device_tags::Error), + #[error(transparent)] + Devices_GetDeviceTag(#[from] devices::get_device_tag::Error), + #[error(transparent)] + Devices_GetAllGroups(#[from] devices::get_all_groups::Error), + #[error(transparent)] + Devices_GetGroup(#[from] devices::get_group::Error), + #[error(transparent)] + Devices_CreateOrUpdateGroup(#[from] devices::create_or_update_group::Error), + #[error(transparent)] + Devices_DeleteGroup(#[from] devices::delete_group::Error), + #[error(transparent)] + Devices_GetGroupUpdateCompliance(#[from] devices::get_group_update_compliance::Error), + #[error(transparent)] + Devices_GetGroupBestUpdates(#[from] devices::get_group_best_updates::Error), + #[error(transparent)] + Deployments_GetAllDeployments(#[from] deployments::get_all_deployments::Error), + #[error(transparent)] + Deployments_GetDeployment(#[from] deployments::get_deployment::Error), + #[error(transparent)] + Deployments_CreateOrUpdateDeployment(#[from] deployments::create_or_update_deployment::Error), + #[error(transparent)] + Deployments_DeleteDeployment(#[from] deployments::delete_deployment::Error), + #[error(transparent)] + Deployments_GetDeploymentStatus(#[from] deployments::get_deployment_status::Error), + #[error(transparent)] + Deployments_GetDeploymentDevices(#[from] deployments::get_deployment_devices::Error), } pub mod deployments { use super::models; @@ -117,6 +185,63 @@ pub mod deployments { action: action.into(), } } + pub fn get_all_deployments(&self, instance_id: impl Into) -> get_all_deployments::Builder { + get_all_deployments::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + filter: None, + } + } + pub fn get_deployment(&self, instance_id: impl Into, deployment_id: impl Into) -> get_deployment::Builder { + get_deployment::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + deployment_id: deployment_id.into(), + } + } + pub fn create_or_update_deployment( + &self, + instance_id: impl Into, + deployment_id: impl Into, + deployment: impl Into, + ) -> create_or_update_deployment::Builder { + create_or_update_deployment::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + deployment_id: deployment_id.into(), + deployment: deployment.into(), + } + } + pub fn delete_deployment(&self, instance_id: impl Into, deployment_id: impl Into) -> delete_deployment::Builder { + delete_deployment::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + deployment_id: deployment_id.into(), + } + } + pub fn get_deployment_status( + &self, + instance_id: impl Into, + deployment_id: impl Into, + ) -> get_deployment_status::Builder { + get_deployment_status::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + deployment_id: deployment_id.into(), + } + } + pub fn get_deployment_devices( + &self, + instance_id: impl Into, + deployment_id: impl Into, + ) -> get_deployment_devices::Builder { + get_deployment_devices::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + deployment_id: deployment_id.into(), + filter: None, + } + } } pub mod cancel_deployment { use super::models; @@ -270,4 +395,2563 @@ pub mod deployments { } } } + pub mod get_all_deployments { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_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!( + "{}/deviceupdate/{}/v2/management/deployments", + self.client.endpoint(), + &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())); + 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::PageableListOfDeployments = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_deployment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) deployment_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/v2/management/deployments/{}", + self.client.endpoint(), + &self.instance_id, + &self.deployment_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())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Deployment = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + status_code => { + let 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_deployment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) deployment_id: String, + pub(crate) deployment: models::Deployment, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/v2/management/deployments/{}", + self.client.endpoint(), + &self.instance_id, + &self.deployment_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())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.deployment).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Deployment = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + status_code => { + let 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_deployment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) deployment_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!( + "{}/deviceupdate/{}/v2/management/deployments/{}", + self.client.endpoint(), + &self.instance_id, + &self.deployment_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())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + status_code => { + let 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_deployment_status { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) deployment_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/v2/management/deployments/{}/status", + self.client.endpoint(), + &self.instance_id, + &self.deployment_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())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeploymentStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + status_code => { + let 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_deployment_devices { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) deployment_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!( + "{}/deviceupdate/{}/v2/management/deployments/{}/devicestates", + self.client.endpoint(), + &self.instance_id, + &self.deployment_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())); + 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::PageableListOfDeploymentDeviceStates = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod updates { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn import_update( + &self, + instance_id: impl Into, + action: impl Into, + update_to_import: impl Into, + ) -> import_update::Builder { + import_update::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + action: action.into(), + update_to_import: update_to_import.into(), + } + } + pub fn get_update( + &self, + instance_id: impl Into, + provider: impl Into, + name: impl Into, + version: impl Into, + ) -> get_update::Builder { + get_update::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + provider: provider.into(), + name: name.into(), + version: version.into(), + if_none_match: None, + } + } + pub fn delete_update( + &self, + instance_id: impl Into, + provider: impl Into, + name: impl Into, + version: impl Into, + ) -> delete_update::Builder { + delete_update::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + provider: provider.into(), + name: name.into(), + version: version.into(), + } + } + pub fn get_providers(&self, instance_id: impl Into) -> get_providers::Builder { + get_providers::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + } + } + pub fn get_names(&self, instance_id: impl Into, provider: impl Into) -> get_names::Builder { + get_names::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + provider: provider.into(), + } + } + pub fn get_versions( + &self, + instance_id: impl Into, + provider: impl Into, + name: impl Into, + ) -> get_versions::Builder { + get_versions::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + provider: provider.into(), + name: name.into(), + } + } + pub fn get_files( + &self, + instance_id: impl Into, + provider: impl Into, + name: impl Into, + version: impl Into, + ) -> get_files::Builder { + get_files::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + provider: provider.into(), + name: name.into(), + version: version.into(), + } + } + pub fn get_file( + &self, + instance_id: impl Into, + provider: impl Into, + name: impl Into, + version: impl Into, + file_id: impl Into, + ) -> get_file::Builder { + get_file::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + provider: provider.into(), + name: name.into(), + version: version.into(), + file_id: file_id.into(), + if_none_match: None, + } + } + pub fn get_operations(&self, instance_id: impl Into) -> get_operations::Builder { + get_operations::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + filter: None, + top: None, + } + } + pub fn get_operation(&self, instance_id: impl Into, operation_id: impl Into) -> get_operation::Builder { + get_operation::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + operation_id: operation_id.into(), + if_none_match: None, + } + } + } + pub mod import_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + TooManyRequests429 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) action: String, + pub(crate) update_to_import: models::ImportUpdateInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/deviceupdate/{}/v2/updates", self.client.endpoint(), &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())); + let action = &self.action; + url.query_pairs_mut().append_pair("action", action); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.update_to_import).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TOO_MANY_REQUESTS => Err(Error::TooManyRequests429 {}), + status_code => { + let 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_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotModified304 {}, + #[error("Error response #response_type")] + NotFound404 {}, + #[error("Error response #response_type")] + TooManyRequests429 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) provider: String, + pub(crate) name: String, + pub(crate) version: String, + pub(crate) if_none_match: Option, + } + impl Builder { + pub fn if_none_match(mut self, if_none_match: impl Into) -> Self { + self.if_none_match = Some(if_none_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/v2/updates/providers/{}/names/{}/versions/{}", + self.client.endpoint(), + &self.instance_id, + &self.provider, + &self.name, + &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())); + if let Some(if_none_match) = &self.if_none_match { + req_builder = req_builder.header("If-None-Match", if_none_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 => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Update = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_MODIFIED => Err(Error::NotModified304 {}), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + http::StatusCode::TOO_MANY_REQUESTS => Err(Error::TooManyRequests429 {}), + status_code => { + let 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_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + TooManyRequests429 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) provider: String, + pub(crate) name: String, + pub(crate) version: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/v2/updates/providers/{}/names/{}/versions/{}", + self.client.endpoint(), + &self.instance_id, + &self.provider, + &self.name, + &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::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())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::TOO_MANY_REQUESTS => Err(Error::TooManyRequests429 {}), + status_code => { + let 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_providers { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + TooManyRequests429 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/deviceupdate/{}/v2/updates/providers", self.client.endpoint(), &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())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PageableListOfStrings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::TOO_MANY_REQUESTS => Err(Error::TooManyRequests429 {}), + status_code => { + let 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_names { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("Error response #response_type")] + TooManyRequests429 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) provider: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/v2/updates/providers/{}/names", + self.client.endpoint(), + &self.instance_id, + &self.provider + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_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 = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PageableListOfStrings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + http::StatusCode::TOO_MANY_REQUESTS => Err(Error::TooManyRequests429 {}), + status_code => { + let 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_versions { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("Error response #response_type")] + TooManyRequests429 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) provider: String, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/v2/updates/providers/{}/names/{}/versions", + self.client.endpoint(), + &self.instance_id, + &self.provider, + &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())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PageableListOfStrings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + http::StatusCode::TOO_MANY_REQUESTS => Err(Error::TooManyRequests429 {}), + status_code => { + let 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_files { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("Error response #response_type")] + TooManyRequests429 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) provider: String, + pub(crate) name: String, + pub(crate) version: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/v2/updates/providers/{}/names/{}/versions/{}/files", + self.client.endpoint(), + &self.instance_id, + &self.provider, + &self.name, + &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())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PageableListOfStrings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + http::StatusCode::TOO_MANY_REQUESTS => Err(Error::TooManyRequests429 {}), + status_code => { + let 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_file { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotModified304 {}, + #[error("Error response #response_type")] + NotFound404 {}, + #[error("Error response #response_type")] + TooManyRequests429 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) provider: String, + pub(crate) name: String, + pub(crate) version: String, + pub(crate) file_id: String, + pub(crate) if_none_match: Option, + } + impl Builder { + pub fn if_none_match(mut self, if_none_match: impl Into) -> Self { + self.if_none_match = Some(if_none_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/v2/updates/providers/{}/names/{}/versions/{}/files/{}", + self.client.endpoint(), + &self.instance_id, + &self.provider, + &self.name, + &self.version, + &self.file_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())); + if let Some(if_none_match) = &self.if_none_match { + req_builder = req_builder.header("If-None-Match", if_none_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 => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::File = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_MODIFIED => Err(Error::NotModified304 {}), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + http::StatusCode::TOO_MANY_REQUESTS => Err(Error::TooManyRequests429 {}), + status_code => { + let 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_operations { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + TooManyRequests429 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: 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!( + "{}/deviceupdate/{}/v2/updates/operations", + self.client.endpoint(), + &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())); + 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::PageableListOfOperations = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::TOO_MANY_REQUESTS => Err(Error::TooManyRequests429 {}), + status_code => { + let 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_operation { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotModified304 {}, + #[error("Error response #response_type")] + NotFound404 {}, + #[error("Error response #response_type")] + TooManyRequests429 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) operation_id: String, + pub(crate) if_none_match: Option, + } + impl Builder { + pub fn if_none_match(mut self, if_none_match: impl Into) -> Self { + self.if_none_match = Some(if_none_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/v2/updates/operations/{}", + self.client.endpoint(), + &self.instance_id, + &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())); + if let Some(if_none_match) = &self.if_none_match { + req_builder = req_builder.header("If-None-Match", if_none_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 => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Operation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_MODIFIED => Err(Error::NotModified304 {}), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + http::StatusCode::TOO_MANY_REQUESTS => Err(Error::TooManyRequests429 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod devices { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_all_device_classes(&self, instance_id: impl Into) -> get_all_device_classes::Builder { + get_all_device_classes::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + } + } + pub fn get_device_class(&self, instance_id: impl Into, device_class_id: impl Into) -> get_device_class::Builder { + get_device_class::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + device_class_id: device_class_id.into(), + } + } + pub fn get_device_class_device_ids( + &self, + instance_id: impl Into, + device_class_id: impl Into, + ) -> get_device_class_device_ids::Builder { + get_device_class_device_ids::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + device_class_id: device_class_id.into(), + } + } + pub fn get_device_class_installable_updates( + &self, + instance_id: impl Into, + device_class_id: impl Into, + ) -> get_device_class_installable_updates::Builder { + get_device_class_installable_updates::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + device_class_id: device_class_id.into(), + } + } + pub fn get_all_devices(&self, instance_id: impl Into) -> get_all_devices::Builder { + get_all_devices::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + filter: None, + } + } + pub fn get_device(&self, instance_id: impl Into, device_id: impl Into) -> get_device::Builder { + get_device::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + device_id: device_id.into(), + } + } + pub fn get_update_compliance(&self, instance_id: impl Into) -> get_update_compliance::Builder { + get_update_compliance::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + } + } + pub fn get_all_device_tags(&self, instance_id: impl Into) -> get_all_device_tags::Builder { + get_all_device_tags::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + } + } + pub fn get_device_tag(&self, instance_id: impl Into, tag_name: impl Into) -> get_device_tag::Builder { + get_device_tag::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + tag_name: tag_name.into(), + } + } + pub fn get_all_groups(&self, instance_id: impl Into) -> get_all_groups::Builder { + get_all_groups::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + } + } + pub fn get_group(&self, instance_id: impl Into, group_id: impl Into) -> get_group::Builder { + get_group::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + group_id: group_id.into(), + } + } + pub fn create_or_update_group( + &self, + instance_id: impl Into, + group_id: impl Into, + group: impl Into, + ) -> create_or_update_group::Builder { + create_or_update_group::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + group_id: group_id.into(), + group: group.into(), + } + } + pub fn delete_group(&self, instance_id: impl Into, group_id: impl Into) -> delete_group::Builder { + delete_group::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + group_id: group_id.into(), + } + } + pub fn get_group_update_compliance( + &self, + instance_id: impl Into, + group_id: impl Into, + ) -> get_group_update_compliance::Builder { + get_group_update_compliance::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + group_id: group_id.into(), + } + } + pub fn get_group_best_updates( + &self, + instance_id: impl Into, + group_id: impl Into, + ) -> get_group_best_updates::Builder { + get_group_best_updates::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + group_id: group_id.into(), + filter: None, + } + } + } + pub mod get_all_device_classes { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/v2/management/deviceclasses", + self.client.endpoint(), + &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())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PageableListOfDeviceClasses = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_device_class { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) device_class_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/v2/management/deviceclasses/{}", + self.client.endpoint(), + &self.instance_id, + &self.device_class_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())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceClass = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + status_code => { + let 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_device_class_device_ids { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) device_class_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/v2/management/deviceclasses/{}/deviceids", + self.client.endpoint(), + &self.instance_id, + &self.device_class_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())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PageableListOfStrings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + status_code => { + let 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_device_class_installable_updates { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) device_class_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/v2/management/deviceclasses/{}/installableupdates", + self.client.endpoint(), + &self.instance_id, + &self.device_class_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())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PageableListOfUpdateIds = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + status_code => { + let 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_all_devices { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_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!( + "{}/deviceupdate/{}/v2/management/devices", + self.client.endpoint(), + &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())); + 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::PageableListOfDevices = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_device { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) device_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/v2/management/devices/{}", + self.client.endpoint(), + &self.instance_id, + &self.device_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())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Device = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + status_code => { + let 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_update_compliance { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/v2/management/updatecompliance", + self.client.endpoint(), + &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())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UpdateCompliance = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_all_device_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/v2/management/devicetags", + self.client.endpoint(), + &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())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PageableListOfDeviceTags = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_device_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) tag_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/v2/management/devicetags/{}", + self.client.endpoint(), + &self.instance_id, + &self.tag_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_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 = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceTag = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + status_code => { + let 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_all_groups { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/deviceupdate/{}/v2/management/groups", self.client.endpoint(), &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())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PageableListOfGroups = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) 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!( + "{}/deviceupdate/{}/v2/management/groups/{}", + self.client.endpoint(), + &self.instance_id, + &self.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())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Group = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + status_code => { + let 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_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + BadRequest400 {}, + #[error("Error response #response_type")] + NotFound404 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) group_id: String, + pub(crate) group: models::Group, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/v2/management/groups/{}", + self.client.endpoint(), + &self.instance_id, + &self.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::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())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.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::Group = + 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 {}), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + status_code => { + let 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_group { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) 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!( + "{}/deviceupdate/{}/v2/management/groups/{}", + self.client.endpoint(), + &self.instance_id, + &self.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::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())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 get_group_update_compliance { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) 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!( + "{}/deviceupdate/{}/v2/management/groups/{}/updateCompliance", + self.client.endpoint(), + &self.instance_id, + &self.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())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UpdateCompliance = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + status_code => { + let 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_group_best_updates { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) group_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!( + "{}/deviceupdate/{}/v2/management/groups/{}/bestUpdates", + self.client.endpoint(), + &self.instance_id, + &self.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())); + 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::PageableListOfUpdatableDevices = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + status_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/svc/deviceupdate/src/package_2021_06_01_preview/operations.rs b/services/svc/deviceupdate/src/package_2021_06_01_preview/operations.rs index 1fa82cd5b7..5d5dd57da9 100644 --- a/services/svc/deviceupdate/src/package_2021_06_01_preview/operations.rs +++ b/services/svc/deviceupdate/src/package_2021_06_01_preview/operations.rs @@ -77,6 +77,9 @@ impl Client { pub fn device_management(&self) -> device_management::Client { device_management::Client(self.clone()) } + pub fn device_update(&self) -> device_update::Client { + device_update::Client(self.clone()) + } } #[non_exhaustive] #[derive(Debug, thiserror :: Error)] @@ -86,6 +89,86 @@ pub enum Error { DeviceManagement_StopDeployment(#[from] device_management::stop_deployment::Error), #[error(transparent)] DeviceManagement_RetryDeployment(#[from] device_management::retry_deployment::Error), + #[error(transparent)] + DeviceUpdate_ListUpdates(#[from] device_update::list_updates::Error), + #[error(transparent)] + DeviceUpdate_ImportUpdate(#[from] device_update::import_update::Error), + #[error(transparent)] + DeviceUpdate_GetUpdate(#[from] device_update::get_update::Error), + #[error(transparent)] + DeviceUpdate_DeleteUpdate(#[from] device_update::delete_update::Error), + #[error(transparent)] + DeviceUpdate_ListProviders(#[from] device_update::list_providers::Error), + #[error(transparent)] + DeviceUpdate_ListNames(#[from] device_update::list_names::Error), + #[error(transparent)] + DeviceUpdate_ListVersions(#[from] device_update::list_versions::Error), + #[error(transparent)] + DeviceUpdate_ListFiles(#[from] device_update::list_files::Error), + #[error(transparent)] + DeviceUpdate_GetFile(#[from] device_update::get_file::Error), + #[error(transparent)] + DeviceUpdate_ListOperations(#[from] device_update::list_operations::Error), + #[error(transparent)] + DeviceUpdate_GetOperation(#[from] device_update::get_operation::Error), + #[error(transparent)] + DeviceManagement_ListDeviceClasses(#[from] device_management::list_device_classes::Error), + #[error(transparent)] + DeviceManagement_GetDeviceClass(#[from] device_management::get_device_class::Error), + #[error(transparent)] + DeviceManagement_ListInstallableUpdatesForDeviceClass(#[from] device_management::list_installable_updates_for_device_class::Error), + #[error(transparent)] + DeviceManagement_ListDevices(#[from] device_management::list_devices::Error), + #[error(transparent)] + DeviceManagement_ImportDevices(#[from] device_management::import_devices::Error), + #[error(transparent)] + DeviceManagement_GetDevice(#[from] device_management::get_device::Error), + #[error(transparent)] + DeviceManagement_GetDeviceModule(#[from] device_management::get_device_module::Error), + #[error(transparent)] + DeviceManagement_GetUpdateCompliance(#[from] device_management::get_update_compliance::Error), + #[error(transparent)] + DeviceManagement_ListDeviceTags(#[from] device_management::list_device_tags::Error), + #[error(transparent)] + DeviceManagement_GetDeviceTag(#[from] device_management::get_device_tag::Error), + #[error(transparent)] + DeviceManagement_ListGroups(#[from] device_management::list_groups::Error), + #[error(transparent)] + DeviceManagement_GetGroup(#[from] device_management::get_group::Error), + #[error(transparent)] + DeviceManagement_CreateOrUpdateGroup(#[from] device_management::create_or_update_group::Error), + #[error(transparent)] + DeviceManagement_DeleteGroup(#[from] device_management::delete_group::Error), + #[error(transparent)] + DeviceManagement_GetGroupUpdateCompliance(#[from] device_management::get_group_update_compliance::Error), + #[error(transparent)] + DeviceManagement_ListBestUpdatesForGroup(#[from] device_management::list_best_updates_for_group::Error), + #[error(transparent)] + DeviceManagement_ListDeploymentsForGroup(#[from] device_management::list_deployments_for_group::Error), + #[error(transparent)] + DeviceManagement_GetDeployment(#[from] device_management::get_deployment::Error), + #[error(transparent)] + DeviceManagement_CreateOrUpdateDeployment(#[from] device_management::create_or_update_deployment::Error), + #[error(transparent)] + DeviceManagement_DeleteDeployment(#[from] device_management::delete_deployment::Error), + #[error(transparent)] + DeviceManagement_GetDeploymentStatus(#[from] device_management::get_deployment_status::Error), + #[error(transparent)] + DeviceManagement_ListDeploymentDevices(#[from] device_management::list_deployment_devices::Error), + #[error(transparent)] + DeviceManagement_GetOperation(#[from] device_management::get_operation::Error), + #[error(transparent)] + DeviceManagement_ListOperations(#[from] device_management::list_operations::Error), + #[error(transparent)] + DeviceManagement_GetLogCollectionOperation(#[from] device_management::get_log_collection_operation::Error), + #[error(transparent)] + DeviceManagement_CollectLogs(#[from] device_management::collect_logs::Error), + #[error(transparent)] + DeviceManagement_ListLogCollectionOperations(#[from] device_management::list_log_collection_operations::Error), + #[error(transparent)] + DeviceManagement_GetLogCollectionOperationDetailedStatus( + #[from] device_management::get_log_collection_operation_detailed_status::Error, + ), } pub mod device_management { use super::models; @@ -121,6 +204,282 @@ pub mod device_management { action: action.into(), } } + pub fn list_device_classes(&self, instance_id: impl Into) -> list_device_classes::Builder { + list_device_classes::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + } + } + pub fn get_device_class(&self, instance_id: impl Into, device_class_id: impl Into) -> get_device_class::Builder { + get_device_class::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + device_class_id: device_class_id.into(), + } + } + pub fn list_installable_updates_for_device_class( + &self, + instance_id: impl Into, + device_class_id: impl Into, + ) -> list_installable_updates_for_device_class::Builder { + list_installable_updates_for_device_class::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + device_class_id: device_class_id.into(), + } + } + pub fn list_devices(&self, instance_id: impl Into) -> list_devices::Builder { + list_devices::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + filter: None, + } + } + pub fn import_devices( + &self, + instance_id: impl Into, + action: impl Into, + import_type: impl Into, + ) -> import_devices::Builder { + import_devices::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + action: action.into(), + import_type: import_type.into(), + } + } + pub fn get_device(&self, instance_id: impl Into, device_id: impl Into) -> get_device::Builder { + get_device::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + device_id: device_id.into(), + } + } + pub fn get_device_module( + &self, + instance_id: impl Into, + device_id: impl Into, + module_id: impl Into, + ) -> get_device_module::Builder { + get_device_module::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + device_id: device_id.into(), + module_id: module_id.into(), + } + } + pub fn get_update_compliance(&self, instance_id: impl Into) -> get_update_compliance::Builder { + get_update_compliance::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + } + } + pub fn list_device_tags(&self, instance_id: impl Into) -> list_device_tags::Builder { + list_device_tags::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + } + } + pub fn get_device_tag(&self, instance_id: impl Into, tag_name: impl Into) -> get_device_tag::Builder { + get_device_tag::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + tag_name: tag_name.into(), + } + } + pub fn list_groups(&self, instance_id: impl Into) -> list_groups::Builder { + list_groups::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + } + } + pub fn get_group(&self, instance_id: impl Into, group_id: impl Into) -> get_group::Builder { + get_group::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + group_id: group_id.into(), + } + } + pub fn create_or_update_group( + &self, + instance_id: impl Into, + group_id: impl Into, + group: impl Into, + ) -> create_or_update_group::Builder { + create_or_update_group::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + group_id: group_id.into(), + group: group.into(), + } + } + pub fn delete_group(&self, instance_id: impl Into, group_id: impl Into) -> delete_group::Builder { + delete_group::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + group_id: group_id.into(), + } + } + pub fn get_group_update_compliance( + &self, + instance_id: impl Into, + group_id: impl Into, + ) -> get_group_update_compliance::Builder { + get_group_update_compliance::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + group_id: group_id.into(), + } + } + pub fn list_best_updates_for_group( + &self, + instance_id: impl Into, + group_id: impl Into, + ) -> list_best_updates_for_group::Builder { + list_best_updates_for_group::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + group_id: group_id.into(), + filter: None, + } + } + pub fn list_deployments_for_group( + &self, + instance_id: impl Into, + group_id: impl Into, + ) -> list_deployments_for_group::Builder { + list_deployments_for_group::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + group_id: group_id.into(), + filter: None, + } + } + pub fn get_deployment( + &self, + instance_id: impl Into, + group_id: impl Into, + deployment_id: impl Into, + ) -> get_deployment::Builder { + get_deployment::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + group_id: group_id.into(), + deployment_id: deployment_id.into(), + } + } + pub fn create_or_update_deployment( + &self, + instance_id: impl Into, + deployment_id: impl Into, + group_id: impl Into, + deployment: impl Into, + ) -> create_or_update_deployment::Builder { + create_or_update_deployment::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + deployment_id: deployment_id.into(), + group_id: group_id.into(), + deployment: deployment.into(), + } + } + pub fn delete_deployment( + &self, + instance_id: impl Into, + group_id: impl Into, + deployment_id: impl Into, + ) -> delete_deployment::Builder { + delete_deployment::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + group_id: group_id.into(), + deployment_id: deployment_id.into(), + } + } + pub fn get_deployment_status( + &self, + instance_id: impl Into, + group_id: impl Into, + deployment_id: impl Into, + ) -> get_deployment_status::Builder { + get_deployment_status::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + group_id: group_id.into(), + deployment_id: deployment_id.into(), + } + } + pub fn list_deployment_devices( + &self, + instance_id: impl Into, + group_id: impl Into, + deployment_id: impl Into, + ) -> list_deployment_devices::Builder { + list_deployment_devices::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + group_id: group_id.into(), + deployment_id: deployment_id.into(), + filter: None, + } + } + pub fn get_operation(&self, instance_id: impl Into, operation_id: impl Into) -> get_operation::Builder { + get_operation::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + operation_id: operation_id.into(), + if_none_match: None, + } + } + pub fn list_operations(&self, instance_id: impl Into) -> list_operations::Builder { + list_operations::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + filter: None, + top: None, + } + } + pub fn get_log_collection_operation( + &self, + instance_id: impl Into, + operation_id: impl Into, + ) -> get_log_collection_operation::Builder { + get_log_collection_operation::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + operation_id: operation_id.into(), + } + } + pub fn collect_logs( + &self, + instance_id: impl Into, + operation_id: impl Into, + log_collection_request: impl Into, + ) -> collect_logs::Builder { + collect_logs::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + operation_id: operation_id.into(), + log_collection_request: log_collection_request.into(), + } + } + pub fn list_log_collection_operations(&self, instance_id: impl Into) -> list_log_collection_operations::Builder { + list_log_collection_operations::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + } + } + pub fn get_log_collection_operation_detailed_status( + &self, + instance_id: impl Into, + operation_id: impl Into, + ) -> get_log_collection_operation_detailed_status::Builder { + get_log_collection_operation_detailed_status::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + operation_id: operation_id.into(), + } + } } pub mod stop_deployment { use super::models; @@ -284,4 +643,3177 @@ pub mod device_management { } } } + pub mod list_device_classes { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/management/deviceclasses", + self.client.endpoint(), + &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", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceClassesList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_device_class { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) device_class_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/management/deviceclasses/{}", + self.client.endpoint(), + &self.instance_id, + &self.device_class_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", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceClass = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_installable_updates_for_device_class { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) device_class_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/management/deviceclasses/{}/installableupdates", + self.client.endpoint(), + &self.instance_id, + &self.device_class_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", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UpdateIdsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_devices { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_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!("{}/deviceupdate/{}/management/devices", self.client.endpoint(), &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", "2021-06-01-preview"); + 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::DevicesList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_devices { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) action: String, + pub(crate) import_type: models::ImportType, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/deviceupdate/{}/management/devices", self.client.endpoint(), &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", "2021-06-01-preview"); + let action = &self.action; + url.query_pairs_mut().append_pair("action", action); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.import_type).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::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_device { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) device_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/management/devices/{}", + self.client.endpoint(), + &self.instance_id, + &self.device_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", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Device = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_device_module { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) device_id: String, + pub(crate) module_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/management/devices/{}/modules/{}", + self.client.endpoint(), + &self.instance_id, + &self.device_id, + &self.module_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", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Device = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_update_compliance { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/management/updatecompliance", + self.client.endpoint(), + &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", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UpdateCompliance = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_device_tags { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/management/devicetags", + self.client.endpoint(), + &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", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceTagsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_device_tag { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) tag_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/management/devicetags/{}", + self.client.endpoint(), + &self.instance_id, + &self.tag_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceTag = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_groups { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/deviceupdate/{}/management/groups", self.client.endpoint(), &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", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GroupsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_group { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) 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!( + "{}/deviceupdate/{}/management/groups/{}", + self.client.endpoint(), + &self.instance_id, + &self.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", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Group = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_group { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) group_id: String, + pub(crate) group: models::Group, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/management/groups/{}", + self.client.endpoint(), + &self.instance_id, + &self.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::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", "2021-06-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.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::Group = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_group { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) group_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!( + "{}/deviceupdate/{}/management/groups/{}", + self.client.endpoint(), + &self.instance_id, + &self.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::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", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::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_group_update_compliance { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) 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!( + "{}/deviceupdate/{}/management/groups/{}/updateCompliance", + self.client.endpoint(), + &self.instance_id, + &self.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", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UpdateCompliance = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_best_updates_for_group { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) group_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!( + "{}/deviceupdate/{}/management/groups/{}/bestUpdates", + self.client.endpoint(), + &self.instance_id, + &self.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", "2021-06-01-preview"); + 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::UpdatableDevicesList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_deployments_for_group { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) group_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!( + "{}/deviceupdate/{}/management/groups/{}/deployments", + self.client.endpoint(), + &self.instance_id, + &self.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", "2021-06-01-preview"); + 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::DeploymentsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_deployment { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) group_id: String, + pub(crate) deployment_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/management/groups/{}/deployments/{}", + self.client.endpoint(), + &self.instance_id, + &self.group_id, + &self.deployment_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", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Deployment = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_deployment { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) deployment_id: String, + pub(crate) group_id: String, + pub(crate) deployment: models::Deployment, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/management/groups/{}/deployments/{}", + self.client.endpoint(), + &self.instance_id, + &self.group_id, + &self.deployment_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", "2021-06-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.deployment).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Deployment = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_deployment { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) group_id: String, + pub(crate) deployment_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!( + "{}/deviceupdate/{}/management/groups/{}/deployments/{}", + self.client.endpoint(), + &self.instance_id, + &self.group_id, + &self.deployment_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", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::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_deployment_status { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) group_id: String, + pub(crate) deployment_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/management/groups/{}/deployments/{}/status", + self.client.endpoint(), + &self.instance_id, + &self.group_id, + &self.deployment_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", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeploymentStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_deployment_devices { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) group_id: String, + pub(crate) deployment_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!( + "{}/deviceupdate/{}/management/groups/{}/deployments/{}/devicestates", + self.client.endpoint(), + &self.instance_id, + &self.group_id, + &self.deployment_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", "2021-06-01-preview"); + 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::DeploymentDeviceStatesList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_operation { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotModified304 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) operation_id: String, + pub(crate) if_none_match: Option, + } + impl Builder { + pub fn if_none_match(mut self, if_none_match: impl Into) -> Self { + self.if_none_match = Some(if_none_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/management/operations/{}", + self.client.endpoint(), + &self.instance_id, + &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", "2021-06-01-preview"); + if let Some(if_none_match) = &self.if_none_match { + req_builder = req_builder.header("If-None-Match", if_none_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 => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceOperation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_MODIFIED => Err(Error::NotModified304 {}), + 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_operations { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: 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!( + "{}/deviceupdate/{}/management/operations", + self.client.endpoint(), + &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", "2021-06-01-preview"); + 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::DeviceOperationsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_log_collection_operation { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_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!( + "{}/deviceupdate/{}/management/deviceDiagnostics/logCollections/{}", + self.client.endpoint(), + &self.instance_id, + &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", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LogCollectionOperation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 collect_logs { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) operation_id: String, + pub(crate) log_collection_request: models::LogCollectionOperation, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/management/deviceDiagnostics/logCollections/{}", + self.client.endpoint(), + &self.instance_id, + &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::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", "2021-06-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.log_collection_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::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LogCollectionOperation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_log_collection_operations { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/management/deviceDiagnostics/logCollections", + self.client.endpoint(), + &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", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LogCollectionOperationList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_log_collection_operation_detailed_status { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_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!( + "{}/deviceupdate/{}/management/deviceDiagnostics/logCollections/{}/detailedStatus", + self.client.endpoint(), + &self.instance_id, + &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", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LogCollectionOperationDetailedStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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 device_update { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_updates(&self, instance_id: impl Into) -> list_updates::Builder { + list_updates::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + search: None, + filter: None, + } + } + pub fn import_update( + &self, + instance_id: impl Into, + action: impl Into, + update_to_import: impl Into, + ) -> import_update::Builder { + import_update::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + action: action.into(), + update_to_import: update_to_import.into(), + } + } + pub fn get_update( + &self, + instance_id: impl Into, + provider: impl Into, + name: impl Into, + version: impl Into, + ) -> get_update::Builder { + get_update::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + provider: provider.into(), + name: name.into(), + version: version.into(), + if_none_match: None, + } + } + pub fn delete_update( + &self, + instance_id: impl Into, + provider: impl Into, + name: impl Into, + version: impl Into, + ) -> delete_update::Builder { + delete_update::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + provider: provider.into(), + name: name.into(), + version: version.into(), + } + } + pub fn list_providers(&self, instance_id: impl Into) -> list_providers::Builder { + list_providers::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + } + } + pub fn list_names(&self, instance_id: impl Into, provider: impl Into) -> list_names::Builder { + list_names::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + provider: provider.into(), + } + } + pub fn list_versions( + &self, + instance_id: impl Into, + provider: impl Into, + name: impl Into, + ) -> list_versions::Builder { + list_versions::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + provider: provider.into(), + name: name.into(), + filter: None, + } + } + pub fn list_files( + &self, + instance_id: impl Into, + provider: impl Into, + name: impl Into, + version: impl Into, + ) -> list_files::Builder { + list_files::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + provider: provider.into(), + name: name.into(), + version: version.into(), + } + } + pub fn get_file( + &self, + instance_id: impl Into, + provider: impl Into, + name: impl Into, + version: impl Into, + file_id: impl Into, + ) -> get_file::Builder { + get_file::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + provider: provider.into(), + name: name.into(), + version: version.into(), + file_id: file_id.into(), + if_none_match: None, + } + } + pub fn list_operations(&self, instance_id: impl Into) -> list_operations::Builder { + list_operations::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + filter: None, + top: None, + } + } + pub fn get_operation(&self, instance_id: impl Into, operation_id: impl Into) -> get_operation::Builder { + get_operation::Builder { + client: self.0.clone(), + instance_id: instance_id.into(), + operation_id: operation_id.into(), + if_none_match: None, + } + } + } + pub mod list_updates { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) search: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn search(mut self, search: impl Into) -> Self { + self.search = Some(search.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!("{}/deviceupdate/{}/updates", self.client.endpoint(), &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", "2021-06-01-preview"); + if let Some(search) = &self.search { + url.query_pairs_mut().append_pair("$search", search); + } + 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::UpdateList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_update { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) action: String, + pub(crate) update_to_import: models::ImportUpdateInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/deviceupdate/{}/updates", self.client.endpoint(), &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", "2021-06-01-preview"); + let action = &self.action; + url.query_pairs_mut().append_pair("action", action); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.update_to_import).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::Update = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotModified304 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) provider: String, + pub(crate) name: String, + pub(crate) version: String, + pub(crate) if_none_match: Option, + } + impl Builder { + pub fn if_none_match(mut self, if_none_match: impl Into) -> Self { + self.if_none_match = Some(if_none_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/updates/providers/{}/names/{}/versions/{}", + self.client.endpoint(), + &self.instance_id, + &self.provider, + &self.name, + &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", "2021-06-01-preview"); + if let Some(if_none_match) = &self.if_none_match { + req_builder = req_builder.header("If-None-Match", if_none_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 => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Update = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_MODIFIED => Err(Error::NotModified304 {}), + 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_update { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) provider: String, + pub(crate) name: String, + pub(crate) version: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/updates/providers/{}/names/{}/versions/{}", + self.client.endpoint(), + &self.instance_id, + &self.provider, + &self.name, + &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::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", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::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_providers { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/deviceupdate/{}/updates/providers", self.client.endpoint(), &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", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StringsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_names { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) provider: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/updates/providers/{}/names", + self.client.endpoint(), + &self.instance_id, + &self.provider + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StringsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_versions { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) provider: String, + pub(crate) 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!( + "{}/deviceupdate/{}/updates/providers/{}/names/{}/versions", + self.client.endpoint(), + &self.instance_id, + &self.provider, + &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", "2021-06-01-preview"); + 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::StringsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_files { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) provider: String, + pub(crate) name: String, + pub(crate) version: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/updates/providers/{}/names/{}/versions/{}/files", + self.client.endpoint(), + &self.instance_id, + &self.provider, + &self.name, + &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", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StringsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_file { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotModified304 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) provider: String, + pub(crate) name: String, + pub(crate) version: String, + pub(crate) file_id: String, + pub(crate) if_none_match: Option, + } + impl Builder { + pub fn if_none_match(mut self, if_none_match: impl Into) -> Self { + self.if_none_match = Some(if_none_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/updates/providers/{}/names/{}/versions/{}/files/{}", + self.client.endpoint(), + &self.instance_id, + &self.provider, + &self.name, + &self.version, + &self.file_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", "2021-06-01-preview"); + if let Some(if_none_match) = &self.if_none_match { + req_builder = req_builder.header("If-None-Match", if_none_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 => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UpdateFile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_MODIFIED => Err(Error::NotModified304 {}), + 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_operations { + use super::models; + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: 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!("{}/deviceupdate/{}/updates/operations", self.client.endpoint(), &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", "2021-06-01-preview"); + 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::UpdateOperationsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + 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_operation { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotModified304 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) instance_id: String, + pub(crate) operation_id: String, + pub(crate) if_none_match: Option, + } + impl Builder { + pub fn if_none_match(mut self, if_none_match: impl Into) -> Self { + self.if_none_match = Some(if_none_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/deviceupdate/{}/updates/operations/{}", + self.client.endpoint(), + &self.instance_id, + &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", "2021-06-01-preview"); + if let Some(if_none_match) = &self.if_none_match { + req_builder = req_builder.header("If-None-Match", if_none_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 => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UpdateOperation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_MODIFIED => Err(Error::NotModified304 {}), + 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/svc/eventgrid/README.md b/services/svc/eventgrid/README.md index 43302c0417..d17b5b6803 100644 --- a/services/svc/eventgrid/README.md +++ b/services/svc/eventgrid/README.md @@ -10,4 +10,4 @@ The default tag is `package-2018-01`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: -- `package-2018-01` has 2 operations from 1 API versions: `2018-01-01`. Use crate feature `package-2018-01` to enable. The operations will be in the `package_2018_01` module. \ No newline at end of file +- `package-2018-01` has 3 operations from 1 API versions: `2018-01-01`. Use crate feature `package-2018-01` to enable. The operations will be in the `package_2018_01` module. \ No newline at end of file diff --git a/services/svc/eventgrid/src/package_2018_01/operations.rs b/services/svc/eventgrid/src/package_2018_01/operations.rs index 3f99d84b45..9e3e3c753a 100644 --- a/services/svc/eventgrid/src/package_2018_01/operations.rs +++ b/services/svc/eventgrid/src/package_2018_01/operations.rs @@ -83,6 +83,8 @@ pub enum Error { PublishCloudEventEvents(#[from] publish_cloud_event_events::Error), #[error(transparent)] PublishCustomEventEvents(#[from] publish_custom_event_events::Error), + #[error(transparent)] + PublishEvents(#[from] publish_events::Error), } impl Client { pub fn publish_cloud_event_events(&self, events: impl Into>) -> publish_cloud_event_events::Builder { @@ -98,6 +100,12 @@ impl Client { events: events.into(), } } + pub fn publish_events(&self, events: impl Into>) -> publish_events::Builder { + publish_events::Builder { + client: self.clone(), + events: events.into(), + } + } } pub mod publish_cloud_event_events { use super::models; @@ -215,3 +223,57 @@ pub mod publish_custom_event_events { } } } +pub mod publish_events { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) events: Vec, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/api/events", 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", "2018-01-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.events).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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 => Err(Error::DefaultResponse { status_code }), + } + }) + } + } +} diff --git a/services/svc/graphrbac/README.md b/services/svc/graphrbac/README.md index 1e03d9e9c7..68b00621fb 100644 --- a/services/svc/graphrbac/README.md +++ b/services/svc/graphrbac/README.md @@ -10,4 +10,4 @@ The default tag is `1.6`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: -- `1.6` has 9 operations from 1 API versions: `1.6`. Use crate feature `1_6` to enable. The operations will be in the `v1_6` module. \ No newline at end of file +- `1.6` has 65 operations from 1 API versions: `1.6`. Use crate feature `1_6` to enable. The operations will be in the `v1_6` module. \ No newline at end of file diff --git a/services/svc/graphrbac/src/v1_6/operations.rs b/services/svc/graphrbac/src/v1_6/operations.rs index 91e5d17747..1db1b41b4d 100644 --- a/services/svc/graphrbac/src/v1_6/operations.rs +++ b/services/svc/graphrbac/src/v1_6/operations.rs @@ -80,6 +80,9 @@ impl Client { pub fn deleted_applications(&self) -> deleted_applications::Client { deleted_applications::Client(self.clone()) } + pub fn domains(&self) -> domains::Client { + domains::Client(self.clone()) + } pub fn groups(&self) -> groups::Client { groups::Client(self.clone()) } @@ -121,6 +124,118 @@ pub enum Error { Users_ListNext(#[from] users::list_next::Error), #[error(transparent)] Objects_GetObjectsByObjectIdsNext(#[from] objects::get_objects_by_object_ids_next::Error), + #[error(transparent)] + SignedInUser_Get(#[from] signed_in_user::get::Error), + #[error(transparent)] + SignedInUser_ListOwnedObjects(#[from] signed_in_user::list_owned_objects::Error), + #[error(transparent)] + Applications_List(#[from] applications::list::Error), + #[error(transparent)] + Applications_Create(#[from] applications::create::Error), + #[error(transparent)] + DeletedApplications_Restore(#[from] deleted_applications::restore::Error), + #[error(transparent)] + DeletedApplications_List(#[from] deleted_applications::list::Error), + #[error(transparent)] + DeletedApplications_HardDelete(#[from] deleted_applications::hard_delete::Error), + #[error(transparent)] + Applications_Get(#[from] applications::get::Error), + #[error(transparent)] + Applications_Patch(#[from] applications::patch::Error), + #[error(transparent)] + Applications_Delete(#[from] applications::delete::Error), + #[error(transparent)] + Applications_ListOwners(#[from] applications::list_owners::Error), + #[error(transparent)] + Applications_AddOwner(#[from] applications::add_owner::Error), + #[error(transparent)] + Applications_RemoveOwner(#[from] applications::remove_owner::Error), + #[error(transparent)] + Applications_ListKeyCredentials(#[from] applications::list_key_credentials::Error), + #[error(transparent)] + Applications_UpdateKeyCredentials(#[from] applications::update_key_credentials::Error), + #[error(transparent)] + Applications_ListPasswordCredentials(#[from] applications::list_password_credentials::Error), + #[error(transparent)] + Applications_UpdatePasswordCredentials(#[from] applications::update_password_credentials::Error), + #[error(transparent)] + Groups_IsMemberOf(#[from] groups::is_member_of::Error), + #[error(transparent)] + Groups_RemoveMember(#[from] groups::remove_member::Error), + #[error(transparent)] + Groups_AddMember(#[from] groups::add_member::Error), + #[error(transparent)] + Groups_List(#[from] groups::list::Error), + #[error(transparent)] + Groups_Create(#[from] groups::create::Error), + #[error(transparent)] + Groups_GetGroupMembers(#[from] groups::get_group_members::Error), + #[error(transparent)] + Groups_Get(#[from] groups::get::Error), + #[error(transparent)] + Groups_Delete(#[from] groups::delete::Error), + #[error(transparent)] + Groups_GetMemberGroups(#[from] groups::get_member_groups::Error), + #[error(transparent)] + Groups_ListOwners(#[from] groups::list_owners::Error), + #[error(transparent)] + Groups_AddOwner(#[from] groups::add_owner::Error), + #[error(transparent)] + Groups_RemoveOwner(#[from] groups::remove_owner::Error), + #[error(transparent)] + ServicePrincipals_List(#[from] service_principals::list::Error), + #[error(transparent)] + ServicePrincipals_Create(#[from] service_principals::create::Error), + #[error(transparent)] + Applications_GetServicePrincipalsIdByAppId(#[from] applications::get_service_principals_id_by_app_id::Error), + #[error(transparent)] + ServicePrincipals_Get(#[from] service_principals::get::Error), + #[error(transparent)] + ServicePrincipals_Update(#[from] service_principals::update::Error), + #[error(transparent)] + ServicePrincipals_Delete(#[from] service_principals::delete::Error), + #[error(transparent)] + ServicePrincipals_ListAppRoleAssignedTo(#[from] service_principals::list_app_role_assigned_to::Error), + #[error(transparent)] + ServicePrincipals_ListAppRoleAssignments(#[from] service_principals::list_app_role_assignments::Error), + #[error(transparent)] + ServicePrincipals_ListOwners(#[from] service_principals::list_owners::Error), + #[error(transparent)] + ServicePrincipals_AddOwner(#[from] service_principals::add_owner::Error), + #[error(transparent)] + ServicePrincipals_RemoveOwner(#[from] service_principals::remove_owner::Error), + #[error(transparent)] + ServicePrincipals_ListKeyCredentials(#[from] service_principals::list_key_credentials::Error), + #[error(transparent)] + ServicePrincipals_UpdateKeyCredentials(#[from] service_principals::update_key_credentials::Error), + #[error(transparent)] + ServicePrincipals_ListPasswordCredentials(#[from] service_principals::list_password_credentials::Error), + #[error(transparent)] + ServicePrincipals_UpdatePasswordCredentials(#[from] service_principals::update_password_credentials::Error), + #[error(transparent)] + Users_List(#[from] users::list::Error), + #[error(transparent)] + Users_Create(#[from] users::create::Error), + #[error(transparent)] + Users_Get(#[from] users::get::Error), + #[error(transparent)] + Users_Update(#[from] users::update::Error), + #[error(transparent)] + Users_Delete(#[from] users::delete::Error), + #[error(transparent)] + Users_GetMemberGroups(#[from] users::get_member_groups::Error), + #[error(transparent)] + Objects_GetObjectsByObjectIds(#[from] objects::get_objects_by_object_ids::Error), + #[error(transparent)] + Domains_List(#[from] domains::list::Error), + #[error(transparent)] + Domains_Get(#[from] domains::get::Error), + #[error(transparent)] + OAuth2PermissionGrant_List(#[from] o_auth2_permission_grant::list::Error), + #[error(transparent)] + OAuth2PermissionGrant_Create(#[from] o_auth2_permission_grant::create::Error), + #[error(transparent)] + OAuth2PermissionGrant_Delete(#[from] o_auth2_permission_grant::delete::Error), } pub mod o_auth2_permission_grant { use super::models; @@ -133,6 +248,27 @@ pub mod o_auth2_permission_grant { tenant_id: tenant_id.into(), } } + pub fn list(&self, tenant_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + tenant_id: tenant_id.into(), + filter: None, + } + } + pub fn create(&self, tenant_id: impl Into) -> create::Builder { + create::Builder { + client: self.0.clone(), + tenant_id: tenant_id.into(), + body: None, + } + } + pub fn delete(&self, object_id: impl Into, tenant_id: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + object_id: object_id.into(), + tenant_id: tenant_id.into(), + } + } } pub mod list_next { use super::models; @@ -211,32 +347,12 @@ pub mod o_auth2_permission_grant { } } } -} -pub mod signed_in_user { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_owned_objects_next( - &self, - next_link: impl Into, - tenant_id: impl Into, - ) -> list_owned_objects_next::Builder { - list_owned_objects_next::Builder { - client: self.0.clone(), - next_link: next_link.into(), - tenant_id: tenant_id.into(), - } - } - } - pub mod list_owned_objects_next { + pub mod list { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::GraphError, - }, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -255,18 +371,19 @@ pub mod signed_in_user { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) next_link: String, pub(crate) tenant_id: String, + pub(crate) filter: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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!( - "{}/{}/{}?SignedInUser_ListOwnedObjectsNext", - self.client.endpoint(), - &self.tenant_id, - &self.next_link - ); + let url_str = &format!("{}/{}/oauth2PermissionGrants", self.client.endpoint(), &self.tenant_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); @@ -277,6 +394,9 @@ pub mod signed_in_user { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "1.6"); + 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)?; @@ -285,17 +405,15 @@ pub mod signed_in_user { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DirectoryObjectListResult = + let rsp_value: models::OAuth2PermissionGrantListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GraphError = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { + Err(Error::UnexpectedResponse { status_code, - value: rsp_value, + body: rsp_body, }) } } @@ -303,39 +421,12 @@ pub mod signed_in_user { } } } -} -pub mod groups { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_next(&self, next_link: impl Into, tenant_id: impl Into) -> list_next::Builder { - list_next::Builder { - client: self.0.clone(), - next_link: next_link.into(), - tenant_id: tenant_id.into(), - } - } - pub fn get_group_members_next( - &self, - next_link: impl Into, - tenant_id: impl Into, - ) -> get_group_members_next::Builder { - get_group_members_next::Builder { - client: self.0.clone(), - next_link: next_link.into(), - tenant_id: tenant_id.into(), - } - } - } - pub mod list_next { + pub mod create { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::GraphError, - }, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, #[error("Failed to parse request URL")] ParseUrl(#[source] url::ParseError), #[error("Failed to build request")] @@ -354,16 +445,20 @@ pub mod groups { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) next_link: String, pub(crate) tenant_id: String, + pub(crate) body: Option, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + 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!("{}/{}/{}?Groups_ListNext", self.client.endpoint(), &self.tenant_id, &self.next_link); + let url_str = &format!("{}/{}/oauth2PermissionGrants", self.client.endpoint(), &self.tenant_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -371,25 +466,28 @@ pub mod groups { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "1.6"); - let req_body = azure_core::EMPTY_BODY; + 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 => { + http::StatusCode::CREATED => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GroupListResult = + let rsp_value: models::OAuth2PermissionGrant = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::GraphError = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Err(Error::DefaultResponse { + Err(Error::UnexpectedResponse { status_code, - value: rsp_value, + body: rsp_body, }) } } @@ -397,7 +495,7 @@ pub mod groups { } } } - pub mod get_group_members_next { + pub mod delete { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -424,21 +522,21 @@ pub mod groups { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) next_link: String, + pub(crate) object_id: String, pub(crate) tenant_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<(), Error>> { Box::pin(async move { let url_str = &format!( - "{}/{}/{}?Groups_GetGroupMembersNext", + "{}/{}/oauth2PermissionGrants/{}", self.client.endpoint(), &self.tenant_id, - &self.next_link + &self.object_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); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -452,12 +550,7 @@ pub mod groups { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::DirectoryObjectListResult = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + 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::GraphError = @@ -473,19 +566,35 @@ pub mod groups { } } } -pub mod applications { +pub mod signed_in_user { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_next(&self, next_link: impl Into, tenant_id: impl Into) -> list_next::Builder { - list_next::Builder { + pub fn list_owned_objects_next( + &self, + next_link: impl Into, + tenant_id: impl Into, + ) -> list_owned_objects_next::Builder { + list_owned_objects_next::Builder { client: self.0.clone(), next_link: next_link.into(), tenant_id: tenant_id.into(), } } + pub fn get(&self, tenant_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + tenant_id: tenant_id.into(), + } + } + pub fn list_owned_objects(&self, tenant_id: impl Into) -> list_owned_objects::Builder { + list_owned_objects::Builder { + client: self.0.clone(), + tenant_id: tenant_id.into(), + } + } } - pub mod list_next { + pub mod list_owned_objects_next { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -516,10 +625,10 @@ pub mod applications { pub(crate) tenant_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!( - "{}/{}/{}?Applications_ListNext", + "{}/{}/{}?SignedInUser_ListOwnedObjectsNext", self.client.endpoint(), &self.tenant_id, &self.next_link @@ -542,7 +651,7 @@ pub mod applications { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApplicationListResult = + let rsp_value: models::DirectoryObjectListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -560,20 +669,7 @@ pub mod applications { } } } -} -pub mod deleted_applications { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_next(&self, next_link: impl Into, tenant_id: impl Into) -> list_next::Builder { - list_next::Builder { - client: self.0.clone(), - next_link: next_link.into(), - tenant_id: tenant_id.into(), - } - } - } - pub mod list_next { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -600,18 +696,12 @@ pub mod deleted_applications { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) next_link: String, pub(crate) tenant_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!( - "{}/{}/{}?DeletedApplications_ListNext", - self.client.endpoint(), - &self.tenant_id, - &self.next_link - ); + let url_str = &format!("{}/{}/me", self.client.endpoint(), &self.tenant_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); @@ -630,7 +720,7 @@ pub mod deleted_applications { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ApplicationListResult = + let rsp_value: models::User = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -648,20 +738,7 @@ pub mod deleted_applications { } } } -} -pub mod service_principals { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_next(&self, next_link: impl Into, tenant_id: impl Into) -> list_next::Builder { - list_next::Builder { - client: self.0.clone(), - next_link: next_link.into(), - tenant_id: tenant_id.into(), - } - } - } - pub mod list_next { + pub mod list_owned_objects { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -688,20 +765,12 @@ pub mod service_principals { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) next_link: String, pub(crate) tenant_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!( - "{}/{}/{}?ServicePrincipals_ListNext", - self.client.endpoint(), - &self.tenant_id, - &self.next_link - ); + let url_str = &format!("{}/{}/me/ownedObjects", self.client.endpoint(), &self.tenant_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); @@ -720,7 +789,7 @@ pub mod service_principals { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ServicePrincipalListResult = + let rsp_value: models::DirectoryObjectListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -739,7 +808,7 @@ pub mod service_principals { } } } -pub mod users { +pub mod groups { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -750,10 +819,4437 @@ pub mod users { tenant_id: tenant_id.into(), } } - } - pub mod list_next { - use super::models; - #[derive(Debug, thiserror :: Error)] + pub fn get_group_members_next( + &self, + next_link: impl Into, + tenant_id: impl Into, + ) -> get_group_members_next::Builder { + get_group_members_next::Builder { + client: self.0.clone(), + next_link: next_link.into(), + tenant_id: tenant_id.into(), + } + } + pub fn is_member_of( + &self, + parameters: impl Into, + tenant_id: impl Into, + ) -> is_member_of::Builder { + is_member_of::Builder { + client: self.0.clone(), + parameters: parameters.into(), + tenant_id: tenant_id.into(), + } + } + pub fn remove_member( + &self, + group_object_id: impl Into, + member_object_id: impl Into, + tenant_id: impl Into, + ) -> remove_member::Builder { + remove_member::Builder { + client: self.0.clone(), + group_object_id: group_object_id.into(), + member_object_id: member_object_id.into(), + tenant_id: tenant_id.into(), + } + } + pub fn add_member( + &self, + group_object_id: impl Into, + parameters: impl Into, + tenant_id: impl Into, + ) -> add_member::Builder { + add_member::Builder { + client: self.0.clone(), + group_object_id: group_object_id.into(), + parameters: parameters.into(), + tenant_id: tenant_id.into(), + } + } + pub fn list(&self, tenant_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + tenant_id: tenant_id.into(), + filter: None, + } + } + pub fn create(&self, parameters: impl Into, tenant_id: impl Into) -> create::Builder { + create::Builder { + client: self.0.clone(), + parameters: parameters.into(), + tenant_id: tenant_id.into(), + } + } + pub fn get_group_members(&self, object_id: impl Into, tenant_id: impl Into) -> get_group_members::Builder { + get_group_members::Builder { + client: self.0.clone(), + object_id: object_id.into(), + tenant_id: tenant_id.into(), + } + } + pub fn get(&self, object_id: impl Into, tenant_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + object_id: object_id.into(), + tenant_id: tenant_id.into(), + } + } + pub fn delete(&self, object_id: impl Into, tenant_id: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + object_id: object_id.into(), + tenant_id: tenant_id.into(), + } + } + pub fn get_member_groups( + &self, + object_id: impl Into, + parameters: impl Into, + tenant_id: impl Into, + ) -> get_member_groups::Builder { + get_member_groups::Builder { + client: self.0.clone(), + object_id: object_id.into(), + parameters: parameters.into(), + tenant_id: tenant_id.into(), + } + } + #[doc = "Directory objects that are owners of the group."] + pub fn list_owners(&self, object_id: impl Into, tenant_id: impl Into) -> list_owners::Builder { + list_owners::Builder { + client: self.0.clone(), + object_id: object_id.into(), + tenant_id: tenant_id.into(), + } + } + pub fn add_owner( + &self, + object_id: impl Into, + parameters: impl Into, + tenant_id: impl Into, + ) -> add_owner::Builder { + add_owner::Builder { + client: self.0.clone(), + object_id: object_id.into(), + parameters: parameters.into(), + tenant_id: tenant_id.into(), + } + } + pub fn remove_owner( + &self, + object_id: impl Into, + owner_object_id: impl Into, + tenant_id: impl Into, + ) -> remove_owner::Builder { + remove_owner::Builder { + client: self.0.clone(), + object_id: object_id.into(), + owner_object_id: owner_object_id.into(), + tenant_id: tenant_id.into(), + } + } + } + pub mod list_next { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) next_link: String, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/{}/{}?Groups_ListNext", self.client.endpoint(), &self.tenant_id, &self.next_link); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GroupListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_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_group_members_next { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) next_link: String, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/{}?Groups_GetGroupMembersNext", + self.client.endpoint(), + &self.tenant_id, + &self.next_link + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DirectoryObjectListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod is_member_of { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) parameters: models::CheckGroupMembershipParameters, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/{}/isMemberOf", self.client.endpoint(), &self.tenant_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", "1.6"); + 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::CheckGroupMembershipResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod remove_member { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) group_object_id: String, + pub(crate) member_object_id: String, + pub(crate) tenant_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!( + "{}/{}/groups/{}/$links/members/{}", + self.client.endpoint(), + &self.tenant_id, + &self.group_object_id, + &self.member_object_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", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::GraphError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod add_member { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) group_object_id: String, + pub(crate) parameters: models::GroupAddMemberParameters, + pub(crate) tenant_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!( + "{}/{}/groups/{}/$links/members", + self.client.endpoint(), + &self.tenant_id, + &self.group_object_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", "1.6"); + 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::GraphError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) tenant_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!("{}/{}/groups", self.client.endpoint(), &self.tenant_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", "1.6"); + 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::GroupListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) parameters: models::GroupCreateParameters, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/{}/groups", self.client.endpoint(), &self.tenant_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", "1.6"); + 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::AdGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_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_group_members { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) object_id: String, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/{}/groups/{}/members", self.client.endpoint(), &self.tenant_id, &self.object_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", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DirectoryObjectListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) object_id: String, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/{}/groups/{}", self.client.endpoint(), &self.tenant_id, &self.object_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", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AdGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) object_id: String, + pub(crate) tenant_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!("{}/{}/groups/{}", self.client.endpoint(), &self.tenant_id, &self.object_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", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::GraphError = + serde_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_member_groups { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) object_id: String, + pub(crate) parameters: models::GroupGetMemberGroupsParameters, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/groups/{}/getMemberGroups", + self.client.endpoint(), + &self.tenant_id, + &self.object_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", "1.6"); + 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::GroupGetMemberGroupsResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_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_owners { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) object_id: String, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/{}/groups/{}/owners", self.client.endpoint(), &self.tenant_id, &self.object_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", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DirectoryObjectListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod add_owner { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) object_id: String, + pub(crate) parameters: models::AddOwnerParameters, + pub(crate) tenant_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!( + "{}/{}/groups/{}/$links/owners", + self.client.endpoint(), + &self.tenant_id, + &self.object_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", "1.6"); + 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::GraphError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod remove_owner { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) object_id: String, + pub(crate) owner_object_id: String, + pub(crate) tenant_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!( + "{}/{}/groups/{}/$links/owners/{}", + self.client.endpoint(), + &self.tenant_id, + &self.object_id, + &self.owner_object_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", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::GraphError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod applications { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_next(&self, next_link: impl Into, tenant_id: impl Into) -> list_next::Builder { + list_next::Builder { + client: self.0.clone(), + next_link: next_link.into(), + tenant_id: tenant_id.into(), + } + } + pub fn list(&self, tenant_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + tenant_id: tenant_id.into(), + filter: None, + } + } + pub fn create(&self, parameters: impl Into, tenant_id: impl Into) -> create::Builder { + create::Builder { + client: self.0.clone(), + parameters: parameters.into(), + tenant_id: tenant_id.into(), + } + } + pub fn get(&self, application_object_id: impl Into, tenant_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + application_object_id: application_object_id.into(), + tenant_id: tenant_id.into(), + } + } + pub fn patch( + &self, + application_object_id: impl Into, + parameters: impl Into, + tenant_id: impl Into, + ) -> patch::Builder { + patch::Builder { + client: self.0.clone(), + application_object_id: application_object_id.into(), + parameters: parameters.into(), + tenant_id: tenant_id.into(), + } + } + pub fn delete(&self, application_object_id: impl Into, tenant_id: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + application_object_id: application_object_id.into(), + tenant_id: tenant_id.into(), + } + } + #[doc = "Directory objects that are owners of the application."] + pub fn list_owners(&self, application_object_id: impl Into, tenant_id: impl Into) -> list_owners::Builder { + list_owners::Builder { + client: self.0.clone(), + application_object_id: application_object_id.into(), + tenant_id: tenant_id.into(), + } + } + pub fn add_owner( + &self, + application_object_id: impl Into, + parameters: impl Into, + tenant_id: impl Into, + ) -> add_owner::Builder { + add_owner::Builder { + client: self.0.clone(), + application_object_id: application_object_id.into(), + parameters: parameters.into(), + tenant_id: tenant_id.into(), + } + } + pub fn remove_owner( + &self, + application_object_id: impl Into, + owner_object_id: impl Into, + tenant_id: impl Into, + ) -> remove_owner::Builder { + remove_owner::Builder { + client: self.0.clone(), + application_object_id: application_object_id.into(), + owner_object_id: owner_object_id.into(), + tenant_id: tenant_id.into(), + } + } + pub fn list_key_credentials( + &self, + application_object_id: impl Into, + tenant_id: impl Into, + ) -> list_key_credentials::Builder { + list_key_credentials::Builder { + client: self.0.clone(), + application_object_id: application_object_id.into(), + tenant_id: tenant_id.into(), + } + } + pub fn update_key_credentials( + &self, + application_object_id: impl Into, + parameters: impl Into, + tenant_id: impl Into, + ) -> update_key_credentials::Builder { + update_key_credentials::Builder { + client: self.0.clone(), + application_object_id: application_object_id.into(), + parameters: parameters.into(), + tenant_id: tenant_id.into(), + } + } + pub fn list_password_credentials( + &self, + application_object_id: impl Into, + tenant_id: impl Into, + ) -> list_password_credentials::Builder { + list_password_credentials::Builder { + client: self.0.clone(), + application_object_id: application_object_id.into(), + tenant_id: tenant_id.into(), + } + } + pub fn update_password_credentials( + &self, + application_object_id: impl Into, + parameters: impl Into, + tenant_id: impl Into, + ) -> update_password_credentials::Builder { + update_password_credentials::Builder { + client: self.0.clone(), + application_object_id: application_object_id.into(), + parameters: parameters.into(), + tenant_id: tenant_id.into(), + } + } + pub fn get_service_principals_id_by_app_id( + &self, + tenant_id: impl Into, + application_id: impl Into, + ) -> get_service_principals_id_by_app_id::Builder { + get_service_principals_id_by_app_id::Builder { + client: self.0.clone(), + tenant_id: tenant_id.into(), + application_id: application_id.into(), + } + } + } + pub mod list_next { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) next_link: String, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/{}?Applications_ListNext", + self.client.endpoint(), + &self.tenant_id, + &self.next_link + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) tenant_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!("{}/{}/applications", self.client.endpoint(), &self.tenant_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", "1.6"); + 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::ApplicationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) parameters: models::ApplicationCreateParameters, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/{}/applications", self.client.endpoint(), &self.tenant_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", "1.6"); + 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::Application = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) application_object_id: String, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/applications/{}", + self.client.endpoint(), + &self.tenant_id, + &self.application_object_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", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Application = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) application_object_id: String, + pub(crate) parameters: models::ApplicationUpdateParameters, + pub(crate) tenant_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!( + "{}/{}/applications/{}", + self.client.endpoint(), + &self.tenant_id, + &self.application_object_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", "1.6"); + 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::GraphError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) application_object_id: String, + pub(crate) tenant_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!( + "{}/{}/applications/{}", + self.client.endpoint(), + &self.tenant_id, + &self.application_object_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", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::GraphError = + serde_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_owners { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) application_object_id: String, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/applications/{}/owners", + self.client.endpoint(), + &self.tenant_id, + &self.application_object_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", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DirectoryObjectListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod add_owner { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) application_object_id: String, + pub(crate) parameters: models::AddOwnerParameters, + pub(crate) tenant_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!( + "{}/{}/applications/{}/$links/owners", + self.client.endpoint(), + &self.tenant_id, + &self.application_object_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", "1.6"); + 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::GraphError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod remove_owner { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) application_object_id: String, + pub(crate) owner_object_id: String, + pub(crate) tenant_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!( + "{}/{}/applications/{}/$links/owners/{}", + self.client.endpoint(), + &self.tenant_id, + &self.application_object_id, + &self.owner_object_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", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::GraphError = + serde_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_key_credentials { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) application_object_id: String, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/applications/{}/keyCredentials", + self.client.endpoint(), + &self.tenant_id, + &self.application_object_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", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::KeyCredentialListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_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_key_credentials { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) application_object_id: String, + pub(crate) parameters: models::KeyCredentialsUpdateParameters, + pub(crate) tenant_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!( + "{}/{}/applications/{}/keyCredentials", + self.client.endpoint(), + &self.tenant_id, + &self.application_object_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", "1.6"); + 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::GraphError = + serde_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_password_credentials { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) application_object_id: String, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/applications/{}/passwordCredentials", + self.client.endpoint(), + &self.tenant_id, + &self.application_object_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", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PasswordCredentialListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_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_password_credentials { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) application_object_id: String, + pub(crate) parameters: models::PasswordCredentialsUpdateParameters, + pub(crate) tenant_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!( + "{}/{}/applications/{}/passwordCredentials", + self.client.endpoint(), + &self.tenant_id, + &self.application_object_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", "1.6"); + 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::GraphError = + serde_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_service_principals_id_by_app_id { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) tenant_id: String, + pub(crate) application_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/servicePrincipalsByAppId/{}/objectId", + self.client.endpoint(), + &self.tenant_id, + &self.application_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", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServicePrincipalObjectResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod deleted_applications { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_next(&self, next_link: impl Into, tenant_id: impl Into) -> list_next::Builder { + list_next::Builder { + client: self.0.clone(), + next_link: next_link.into(), + tenant_id: tenant_id.into(), + } + } + pub fn restore(&self, object_id: impl Into, tenant_id: impl Into) -> restore::Builder { + restore::Builder { + client: self.0.clone(), + object_id: object_id.into(), + tenant_id: tenant_id.into(), + } + } + pub fn list(&self, tenant_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + tenant_id: tenant_id.into(), + filter: None, + } + } + pub fn hard_delete(&self, application_object_id: impl Into, tenant_id: impl Into) -> hard_delete::Builder { + hard_delete::Builder { + client: self.0.clone(), + application_object_id: application_object_id.into(), + tenant_id: tenant_id.into(), + } + } + } + pub mod list_next { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) next_link: String, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/{}?DeletedApplications_ListNext", + self.client.endpoint(), + &self.tenant_id, + &self.next_link + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_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 { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) object_id: String, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/deletedApplications/{}/restore", + self.client.endpoint(), + &self.tenant_id, + &self.object_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", "1.6"); + 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::Application = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) tenant_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!("{}/{}/deletedApplications", self.client.endpoint(), &self.tenant_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", "1.6"); + 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::ApplicationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod hard_delete { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) application_object_id: String, + pub(crate) tenant_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!( + "{}/{}/deletedApplications/{}", + self.client.endpoint(), + &self.tenant_id, + &self.application_object_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", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::GraphError = + serde_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_principals { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_next(&self, next_link: impl Into, tenant_id: impl Into) -> list_next::Builder { + list_next::Builder { + client: self.0.clone(), + next_link: next_link.into(), + tenant_id: tenant_id.into(), + } + } + pub fn list(&self, tenant_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + tenant_id: tenant_id.into(), + filter: None, + } + } + pub fn create( + &self, + parameters: impl Into, + tenant_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + parameters: parameters.into(), + tenant_id: tenant_id.into(), + } + } + pub fn get(&self, object_id: impl Into, tenant_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + object_id: object_id.into(), + tenant_id: tenant_id.into(), + } + } + pub fn update( + &self, + object_id: impl Into, + parameters: impl Into, + tenant_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + object_id: object_id.into(), + parameters: parameters.into(), + tenant_id: tenant_id.into(), + } + } + pub fn delete(&self, object_id: impl Into, tenant_id: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + object_id: object_id.into(), + tenant_id: tenant_id.into(), + } + } + #[doc = "Principals (users, groups, and service principals) that are assigned to this service principal."] + pub fn list_app_role_assigned_to( + &self, + object_id: impl Into, + tenant_id: impl Into, + ) -> list_app_role_assigned_to::Builder { + list_app_role_assigned_to::Builder { + client: self.0.clone(), + object_id: object_id.into(), + tenant_id: tenant_id.into(), + } + } + #[doc = "Applications that the service principal is assigned to."] + pub fn list_app_role_assignments( + &self, + object_id: impl Into, + tenant_id: impl Into, + ) -> list_app_role_assignments::Builder { + list_app_role_assignments::Builder { + client: self.0.clone(), + object_id: object_id.into(), + tenant_id: tenant_id.into(), + } + } + #[doc = "Directory objects that are owners of this service principal."] + pub fn list_owners(&self, object_id: impl Into, tenant_id: impl Into) -> list_owners::Builder { + list_owners::Builder { + client: self.0.clone(), + object_id: object_id.into(), + tenant_id: tenant_id.into(), + } + } + pub fn add_owner( + &self, + object_id: impl Into, + parameters: impl Into, + tenant_id: impl Into, + ) -> add_owner::Builder { + add_owner::Builder { + client: self.0.clone(), + object_id: object_id.into(), + parameters: parameters.into(), + tenant_id: tenant_id.into(), + } + } + pub fn remove_owner( + &self, + object_id: impl Into, + owner_object_id: impl Into, + tenant_id: impl Into, + ) -> remove_owner::Builder { + remove_owner::Builder { + client: self.0.clone(), + object_id: object_id.into(), + owner_object_id: owner_object_id.into(), + tenant_id: tenant_id.into(), + } + } + pub fn list_key_credentials(&self, object_id: impl Into, tenant_id: impl Into) -> list_key_credentials::Builder { + list_key_credentials::Builder { + client: self.0.clone(), + object_id: object_id.into(), + tenant_id: tenant_id.into(), + } + } + pub fn update_key_credentials( + &self, + object_id: impl Into, + parameters: impl Into, + tenant_id: impl Into, + ) -> update_key_credentials::Builder { + update_key_credentials::Builder { + client: self.0.clone(), + object_id: object_id.into(), + parameters: parameters.into(), + tenant_id: tenant_id.into(), + } + } + pub fn list_password_credentials( + &self, + object_id: impl Into, + tenant_id: impl Into, + ) -> list_password_credentials::Builder { + list_password_credentials::Builder { + client: self.0.clone(), + object_id: object_id.into(), + tenant_id: tenant_id.into(), + } + } + pub fn update_password_credentials( + &self, + object_id: impl Into, + parameters: impl Into, + tenant_id: impl Into, + ) -> update_password_credentials::Builder { + update_password_credentials::Builder { + client: self.0.clone(), + object_id: object_id.into(), + parameters: parameters.into(), + tenant_id: tenant_id.into(), + } + } + } + pub mod list_next { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) next_link: String, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/{}?ServicePrincipals_ListNext", + self.client.endpoint(), + &self.tenant_id, + &self.next_link + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServicePrincipalListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) tenant_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!("{}/{}/servicePrincipals", self.client.endpoint(), &self.tenant_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", "1.6"); + 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::ServicePrincipalListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) parameters: models::ServicePrincipalCreateParameters, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/{}/servicePrincipals", self.client.endpoint(), &self.tenant_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", "1.6"); + 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::ServicePrincipal = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) object_id: String, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/servicePrincipals/{}", + self.client.endpoint(), + &self.tenant_id, + &self.object_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", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServicePrincipal = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) object_id: String, + pub(crate) parameters: models::ServicePrincipalUpdateParameters, + pub(crate) tenant_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!( + "{}/{}/servicePrincipals/{}", + self.client.endpoint(), + &self.tenant_id, + &self.object_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", "1.6"); + 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::GraphError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) object_id: String, + pub(crate) tenant_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!( + "{}/{}/servicePrincipals/{}", + self.client.endpoint(), + &self.tenant_id, + &self.object_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", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::GraphError = + serde_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_app_role_assigned_to { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) object_id: String, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/servicePrincipals/{}/appRoleAssignedTo", + self.client.endpoint(), + &self.tenant_id, + &self.object_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", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AppRoleAssignmentListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_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_app_role_assignments { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) object_id: String, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/servicePrincipals/{}/appRoleAssignments", + self.client.endpoint(), + &self.tenant_id, + &self.object_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", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AppRoleAssignmentListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_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_owners { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) object_id: String, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/servicePrincipals/{}/owners", + self.client.endpoint(), + &self.tenant_id, + &self.object_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", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DirectoryObjectListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod add_owner { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) object_id: String, + pub(crate) parameters: models::AddOwnerParameters, + pub(crate) tenant_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!( + "{}/{}/servicePrincipals/{}/$links/owners", + self.client.endpoint(), + &self.tenant_id, + &self.object_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", "1.6"); + 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::GraphError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod remove_owner { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) object_id: String, + pub(crate) owner_object_id: String, + pub(crate) tenant_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!( + "{}/{}/servicePrincipals/{}/$links/owners/{}", + self.client.endpoint(), + &self.tenant_id, + &self.object_id, + &self.owner_object_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", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::GraphError = + serde_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_key_credentials { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) object_id: String, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/servicePrincipals/{}/keyCredentials", + self.client.endpoint(), + &self.tenant_id, + &self.object_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", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::KeyCredentialListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_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_key_credentials { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) object_id: String, + pub(crate) parameters: models::KeyCredentialsUpdateParameters, + pub(crate) tenant_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!( + "{}/{}/servicePrincipals/{}/keyCredentials", + self.client.endpoint(), + &self.tenant_id, + &self.object_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", "1.6"); + 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::GraphError = + serde_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_password_credentials { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) object_id: String, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/servicePrincipals/{}/passwordCredentials", + self.client.endpoint(), + &self.tenant_id, + &self.object_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", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PasswordCredentialListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_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_password_credentials { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) object_id: String, + pub(crate) parameters: models::PasswordCredentialsUpdateParameters, + pub(crate) tenant_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!( + "{}/{}/servicePrincipals/{}/passwordCredentials", + self.client.endpoint(), + &self.tenant_id, + &self.object_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", "1.6"); + 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::GraphError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod users { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_next(&self, next_link: impl Into, tenant_id: impl Into) -> list_next::Builder { + list_next::Builder { + client: self.0.clone(), + next_link: next_link.into(), + tenant_id: tenant_id.into(), + } + } + pub fn list(&self, tenant_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + tenant_id: tenant_id.into(), + filter: None, + expand: None, + top: None, + } + } + pub fn create(&self, parameters: impl Into, tenant_id: impl Into) -> create::Builder { + create::Builder { + client: self.0.clone(), + parameters: parameters.into(), + tenant_id: tenant_id.into(), + } + } + pub fn get(&self, upn_or_object_id: impl Into, tenant_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + upn_or_object_id: upn_or_object_id.into(), + tenant_id: tenant_id.into(), + } + } + pub fn update( + &self, + upn_or_object_id: impl Into, + parameters: impl Into, + tenant_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + upn_or_object_id: upn_or_object_id.into(), + parameters: parameters.into(), + tenant_id: tenant_id.into(), + } + } + pub fn delete(&self, upn_or_object_id: impl Into, tenant_id: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + upn_or_object_id: upn_or_object_id.into(), + tenant_id: tenant_id.into(), + } + } + pub fn get_member_groups( + &self, + object_id: impl Into, + parameters: impl Into, + tenant_id: impl Into, + ) -> get_member_groups::Builder { + get_member_groups::Builder { + client: self.0.clone(), + object_id: object_id.into(), + parameters: parameters.into(), + tenant_id: tenant_id.into(), + } + } + } + pub mod list_next { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) next_link: String, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/{}/{}?Users_ListNext", self.client.endpoint(), &self.tenant_id, &self.next_link); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UserListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) tenant_id: String, + pub(crate) filter: Option, + pub(crate) expand: Option, + pub(crate) top: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn top(mut self, top: i64) -> 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!("{}/{}/users", self.client.endpoint(), &self.tenant_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", "1.6"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + 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()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UserListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) parameters: models::UserCreateParameters, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/{}/users", self.client.endpoint(), &self.tenant_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", "1.6"); + 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::User = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) upn_or_object_id: String, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/{}/users/{}", self.client.endpoint(), &self.tenant_id, &self.upn_or_object_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", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::User = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) upn_or_object_id: String, + pub(crate) parameters: models::UserUpdateParameters, + pub(crate) tenant_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!("{}/{}/users/{}", self.client.endpoint(), &self.tenant_id, &self.upn_or_object_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", "1.6"); + 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::GraphError = + serde_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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::GraphError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) upn_or_object_id: String, + pub(crate) tenant_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!("{}/{}/users/{}", self.client.endpoint(), &self.tenant_id, &self.upn_or_object_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", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let 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::GraphError = + serde_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_member_groups { + use super::models; + #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] DefaultResponse { @@ -778,16 +5274,22 @@ pub mod users { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) next_link: String, + pub(crate) object_id: String, + pub(crate) parameters: models::UserGetMemberGroupsParameters, pub(crate) tenant_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!("{}/{}/{}?Users_ListNext", self.client.endpoint(), &self.tenant_id, &self.next_link); + let url_str = &format!( + "{}/{}/users/{}/getMemberGroups", + self.client.endpoint(), + &self.tenant_id, + &self.object_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); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -795,7 +5297,8 @@ pub mod users { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "1.6"); - let req_body = azure_core::EMPTY_BODY; + 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)?; @@ -803,7 +5306,7 @@ pub mod users { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::UserListResult = + let rsp_value: models::UserGetMemberGroupsResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -837,6 +5340,17 @@ pub mod objects { tenant_id: tenant_id.into(), } } + pub fn get_objects_by_object_ids( + &self, + parameters: impl Into, + tenant_id: impl Into, + ) -> get_objects_by_object_ids::Builder { + get_objects_by_object_ids::Builder { + client: self.0.clone(), + parameters: parameters.into(), + tenant_id: tenant_id.into(), + } + } } pub mod get_objects_by_object_ids_next { use super::models; @@ -909,4 +5423,227 @@ pub mod objects { } } } + pub mod get_objects_by_object_ids { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) parameters: models::GetObjectsParameters, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/{}/getObjectsByObjectIds", self.client.endpoint(), &self.tenant_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", "1.6"); + 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::DirectoryObjectListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod domains { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, tenant_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + tenant_id: tenant_id.into(), + filter: None, + } + } + pub fn get(&self, domain_name: impl Into, tenant_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + domain_name: domain_name.into(), + tenant_id: tenant_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) tenant_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!("{}/{}/domains", self.client.endpoint(), &self.tenant_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", "1.6"); + 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::DomainListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let 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; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) domain_name: String, + pub(crate) tenant_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/{}/domains/{}", self.client.endpoint(), &self.tenant_id, &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", "1.6"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Domain = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_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/svc/keyvault/Cargo.toml b/services/svc/keyvault/Cargo.toml index 2c0994b8b1..bc438c147c 100644 --- a/services/svc/keyvault/Cargo.toml +++ b/services/svc/keyvault/Cargo.toml @@ -22,7 +22,6 @@ futures = "0.3" [dev-dependencies] azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } -chrono = "0.4.0" [package.metadata.docs.rs] features = ["no-default-tag", "package-preview-7_3-preview", "package-7_2", "package-7_2-preview", "package-7_1"] diff --git a/services/svc/synapse/README.md b/services/svc/synapse/README.md index e41a10a4e3..c91c51bc01 100644 --- a/services/svc/synapse/README.md +++ b/services/svc/synapse/README.md @@ -10,20 +10,20 @@ The default tag is `package-artifacts-composite-v3`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: -- `package-artifacts-composite-v3` has 84 operations from 5 API versions: `2019-06-01-preview`, `2020-12-01`, `2021-06-01-preview`, `2021-07-01-preview`, `2021-11-01-preview`. Use crate feature `package-artifacts-composite-v3` to enable. The operations will be in the `package_artifacts_composite_v3` module. -- `package-artifacts-composite-v2` has 80 operations from 4 API versions: `2019-06-01-preview`, `2020-12-01`, `2021-06-01-preview`, `2021-11-01-preview`. Use crate feature `package-artifacts-composite-v2` to enable. The operations will be in the `package_artifacts_composite_v2` module. -- `package-artifacts-composite-v1` has 80 operations from 3 API versions: `2019-06-01-preview`, `2020-12-01`, `2021-06-01-preview`. Use crate feature `package-artifacts-composite-v1` to enable. The operations will be in the `package_artifacts_composite_v1` module. -- `package-artifacts-2021-06-01-preview` has 77 operations from 3 API versions: `2019-06-01-preview`, `2019-11-01-preview`, `2021-06-01-preview`. Use crate feature `package-artifacts-2021-06-01-preview` to enable. The operations will be in the `package_artifacts_2021_06_01_preview` module. +- `package-artifacts-composite-v3` has 90 operations from 5 API versions: `2019-06-01-preview`, `2020-12-01`, `2021-06-01-preview`, `2021-07-01-preview`, `2021-11-01-preview`. Use crate feature `package-artifacts-composite-v3` to enable. The operations will be in the `package_artifacts_composite_v3` module. +- `package-artifacts-composite-v2` has 86 operations from 4 API versions: `2019-06-01-preview`, `2020-12-01`, `2021-06-01-preview`, `2021-11-01-preview`. Use crate feature `package-artifacts-composite-v2` to enable. The operations will be in the `package_artifacts_composite_v2` module. +- `package-artifacts-composite-v1` has 86 operations from 3 API versions: `2019-06-01-preview`, `2020-12-01`, `2021-06-01-preview`. Use crate feature `package-artifacts-composite-v1` to enable. The operations will be in the `package_artifacts_composite_v1` module. +- `package-artifacts-2021-06-01-preview` has 83 operations from 3 API versions: `2019-06-01-preview`, `2019-11-01-preview`, `2021-06-01-preview`. Use crate feature `package-artifacts-2021-06-01-preview` to enable. The operations will be in the `package_artifacts_2021_06_01_preview` module. - `package-vnet-2021-06-01-preview` has 4 operations from 1 API versions: `2021-06-01-preview`. Use crate feature `package-vnet-2021-06-01-preview` to enable. The operations will be in the `package_vnet_2021_06_01_preview` module. - `package-kql-script-2021-06-preview` has 5 operations from 2 API versions: `2019-06-01-preview`, `2021-06-01-preview`. Use crate feature `package-kql-script-2021-06-preview` to enable. The operations will be in the `package_kql_script_2021_06_preview` module. - `package-link-connection-2021-12-01-preview` has 11 operations from 1 API versions: `2021-12-01-preview`. Use crate feature `package-link-connection-2021-12-01-preview` to enable. The operations will be in the `package_link_connection_2021_12_01_preview` module. -- `package-artifacts-2020-12-01` has 72 operations from 2 API versions: `2019-06-01-preview`, `2020-12-01`. Use crate feature `package-artifacts-2020-12-01` to enable. The operations will be in the `package_artifacts_2020_12_01` module. +- `package-artifacts-2020-12-01` has 78 operations from 2 API versions: `2019-06-01-preview`, `2020-12-01`. Use crate feature `package-artifacts-2020-12-01` to enable. The operations will be in the `package_artifacts_2020_12_01` module. - `package-monitoring-2020-12-01` has 2 operations from 1 API versions: `2020-12-01`. Use crate feature `package-monitoring-2020-12-01` to enable. The operations will be in the `package_monitoring_2020_12_01` module. - `package-access-control-2020-12-01` has 8 operations from 1 API versions: `2020-12-01`. Use crate feature `package-access-control-2020-12-01` to enable. The operations will be in the `package_access_control_2020_12_01` module. - `package-vnet-2020-12-01` has 4 operations from 1 API versions: `2020-12-01`. Use crate feature `package-vnet-2020-12-01` to enable. The operations will be in the `package_vnet_2020_12_01` module. - `package-spark-2020-12-01` has 13 operations from 1 API versions: `2020-12-01`. Use crate feature `package-spark-2020-12-01` to enable. The operations will be in the `package_spark_2020_12_01` module. - `package-spark-2019-11-01-preview` has 13 operations from 1 API versions: `2019-11-01-preview`. Use crate feature `package-spark-2019-11-01-preview` to enable. The operations will be in the `package_spark_2019_11_01_preview` module. -- `package-artifacts-2019-06-01-preview` has 69 operations from 2 API versions: `2019-06-01-preview`, `2019-11-01-preview`. Use crate feature `package-artifacts-2019-06-01-preview` to enable. The operations will be in the `package_artifacts_2019_06_01_preview` module. +- `package-artifacts-2019-06-01-preview` has 75 operations from 2 API versions: `2019-06-01-preview`, `2019-11-01-preview`. Use crate feature `package-artifacts-2019-06-01-preview` to enable. The operations will be in the `package_artifacts_2019_06_01_preview` module. - `package-access-control-2020-02-01-preview` has 7 operations from 1 API versions: `2020-02-01-preview`. Use crate feature `package-access-control-2020-02-01-preview` to enable. The operations will be in the `package_access_control_2020_02_01_preview` module. - `package-access-control-2020-08-01-preview` has 8 operations from 1 API versions: `2020-08-01-preview`. Use crate feature `package-access-control-2020-08-01-preview` to enable. The operations will be in the `package_access_control_2020_08_01_preview` module. - `package-vnet-2019-06-01-preview` has 4 operations from 1 API versions: `2019-06-01-preview`. Use crate feature `package-vnet-2019-06-01-preview` to enable. The operations will be in the `package_vnet_2019_06_01_preview` module. diff --git a/services/svc/synapse/src/package_artifacts_2019_06_01_preview/operations.rs b/services/svc/synapse/src/package_artifacts_2019_06_01_preview/operations.rs index 2589a3c8f4..39652be8ce 100644 --- a/services/svc/synapse/src/package_artifacts_2019_06_01_preview/operations.rs +++ b/services/svc/synapse/src/package_artifacts_2019_06_01_preview/operations.rs @@ -269,6 +269,18 @@ pub enum Error { #[error(transparent)] Library_Append(#[from] library::append::Error), #[error(transparent)] + Library_List(#[from] library::list::Error), + #[error(transparent)] + Library_Flush(#[from] library::flush::Error), + #[error(transparent)] + Library_GetOperationResult(#[from] library::get_operation_result::Error), + #[error(transparent)] + Library_Get(#[from] library::get::Error), + #[error(transparent)] + Library_Create(#[from] library::create::Error), + #[error(transparent)] + Library_Delete(#[from] library::delete::Error), + #[error(transparent)] WorkspaceGitRepoManagement_GetGitHubAccessToken(#[from] workspace_git_repo_management::get_git_hub_access_token::Error), } pub mod linked_service { @@ -5853,6 +5865,39 @@ pub mod library { x_ms_blob_condition_appendpos: None, } } + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + pub fn flush(&self, library_name: impl Into) -> flush::Builder { + flush::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } + pub fn get_operation_result(&self, operation_id: impl Into) -> get_operation_result::Builder { + get_operation_result::Builder { + client: self.0.clone(), + operation_id: operation_id.into(), + } + } + pub fn get(&self, library_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } + pub fn create(&self, library_name: impl Into) -> create::Builder { + create::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } + pub fn delete(&self, library_name: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } } pub mod append { use super::models; @@ -5931,6 +5976,455 @@ pub mod library { } } } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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!("{}/libraries", 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", "2019-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LibraryListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod flush { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::LibraryResourceInfo), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}/flush", self.client.endpoint(), &self.library_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-06-01-preview"); + 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::LibraryResourceInfo = + 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 get_operation_result { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::LibraryResource), + Accepted202(models::OperationResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + 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!("{}/libraryOperationResults/{}", self.client.endpoint(), &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", "2019-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LibraryResource = + 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::OperationResult = + 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 get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotModified304 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}", self.client.endpoint(), &self.library_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2019-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LibraryResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_MODIFIED => Err(Error::NotModified304 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::LibraryResourceInfo), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}", self.client.endpoint(), &self.library_name); + let mut url = 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", "2019-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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::LibraryResourceInfo = + 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; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::LibraryResourceInfo), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}", self.client.endpoint(), &self.library_name); + let mut url = 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", "2019-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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::LibraryResourceInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + 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 workspace_git_repo_management { use super::models; diff --git a/services/svc/synapse/src/package_artifacts_2020_12_01/operations.rs b/services/svc/synapse/src/package_artifacts_2020_12_01/operations.rs index cc0a34d758..e21ba403e0 100644 --- a/services/svc/synapse/src/package_artifacts_2020_12_01/operations.rs +++ b/services/svc/synapse/src/package_artifacts_2020_12_01/operations.rs @@ -194,6 +194,18 @@ pub enum Error { #[error(transparent)] Library_Append(#[from] library::append::Error), #[error(transparent)] + Library_List(#[from] library::list::Error), + #[error(transparent)] + Library_Flush(#[from] library::flush::Error), + #[error(transparent)] + Library_GetOperationResult(#[from] library::get_operation_result::Error), + #[error(transparent)] + Library_Get(#[from] library::get::Error), + #[error(transparent)] + Library_Create(#[from] library::create::Error), + #[error(transparent)] + Library_Delete(#[from] library::delete::Error), + #[error(transparent)] Notebook_GetNotebooksByWorkspace(#[from] notebook::get_notebooks_by_workspace::Error), #[error(transparent)] Notebook_GetNotebookSummaryByWorkSpace(#[from] notebook::get_notebook_summary_by_work_space::Error), @@ -2360,6 +2372,39 @@ pub mod library { x_ms_blob_condition_appendpos: None, } } + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + pub fn flush(&self, library_name: impl Into) -> flush::Builder { + flush::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } + pub fn get_operation_result(&self, operation_id: impl Into) -> get_operation_result::Builder { + get_operation_result::Builder { + client: self.0.clone(), + operation_id: operation_id.into(), + } + } + pub fn get(&self, library_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } + pub fn create(&self, library_name: impl Into) -> create::Builder { + create::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } + pub fn delete(&self, library_name: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } } pub mod append { use super::models; @@ -2438,6 +2483,455 @@ pub mod library { } } } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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!("{}/libraries", 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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LibraryListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod flush { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::LibraryResourceInfo), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}/flush", self.client.endpoint(), &self.library_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + 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::LibraryResourceInfo = + 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 get_operation_result { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::LibraryResource), + Accepted202(models::OperationResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + 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!("{}/libraryOperationResults/{}", self.client.endpoint(), &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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LibraryResource = + 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::OperationResult = + 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 get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotModified304 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}", self.client.endpoint(), &self.library_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LibraryResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_MODIFIED => Err(Error::NotModified304 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::LibraryResourceInfo), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}", self.client.endpoint(), &self.library_name); + let mut url = 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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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::LibraryResourceInfo = + 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; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::LibraryResourceInfo), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}", self.client.endpoint(), &self.library_name); + let mut url = 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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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::LibraryResourceInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + 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 notebook { use super::models; diff --git a/services/svc/synapse/src/package_artifacts_2021_06_01_preview/operations.rs b/services/svc/synapse/src/package_artifacts_2021_06_01_preview/operations.rs index 9477737ac1..7210312341 100644 --- a/services/svc/synapse/src/package_artifacts_2021_06_01_preview/operations.rs +++ b/services/svc/synapse/src/package_artifacts_2021_06_01_preview/operations.rs @@ -197,6 +197,18 @@ pub enum Error { #[error(transparent)] Library_Append(#[from] library::append::Error), #[error(transparent)] + Library_List(#[from] library::list::Error), + #[error(transparent)] + Library_Flush(#[from] library::flush::Error), + #[error(transparent)] + Library_GetOperationResult(#[from] library::get_operation_result::Error), + #[error(transparent)] + Library_Get(#[from] library::get::Error), + #[error(transparent)] + Library_Create(#[from] library::create::Error), + #[error(transparent)] + Library_Delete(#[from] library::delete::Error), + #[error(transparent)] Notebook_GetNotebooksByWorkspace(#[from] notebook::get_notebooks_by_workspace::Error), #[error(transparent)] Notebook_GetNotebookSummaryByWorkSpace(#[from] notebook::get_notebook_summary_by_work_space::Error), @@ -2373,6 +2385,39 @@ pub mod library { x_ms_blob_condition_appendpos: None, } } + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + pub fn flush(&self, library_name: impl Into) -> flush::Builder { + flush::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } + pub fn get_operation_result(&self, operation_id: impl Into) -> get_operation_result::Builder { + get_operation_result::Builder { + client: self.0.clone(), + operation_id: operation_id.into(), + } + } + pub fn get(&self, library_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } + pub fn create(&self, library_name: impl Into) -> create::Builder { + create::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } + pub fn delete(&self, library_name: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } } pub mod append { use super::models; @@ -2451,6 +2496,455 @@ pub mod library { } } } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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!("{}/libraries", 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", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LibraryListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod flush { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::LibraryResourceInfo), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}/flush", self.client.endpoint(), &self.library_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-06-01-preview"); + 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::LibraryResourceInfo = + 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 get_operation_result { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::LibraryResource), + Accepted202(models::OperationResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + 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!("{}/libraryOperationResults/{}", self.client.endpoint(), &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", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LibraryResource = + 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::OperationResult = + 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 get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotModified304 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}", self.client.endpoint(), &self.library_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LibraryResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_MODIFIED => Err(Error::NotModified304 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::LibraryResourceInfo), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}", self.client.endpoint(), &self.library_name); + let mut url = 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", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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::LibraryResourceInfo = + 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; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::LibraryResourceInfo), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}", self.client.endpoint(), &self.library_name); + let mut url = 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", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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::LibraryResourceInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + 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 notebook { use super::models; diff --git a/services/svc/synapse/src/package_artifacts_composite_v1/operations.rs b/services/svc/synapse/src/package_artifacts_composite_v1/operations.rs index 59e51e232e..a896612f99 100644 --- a/services/svc/synapse/src/package_artifacts_composite_v1/operations.rs +++ b/services/svc/synapse/src/package_artifacts_composite_v1/operations.rs @@ -217,6 +217,18 @@ pub enum Error { #[error(transparent)] Library_Append(#[from] library::append::Error), #[error(transparent)] + Library_List(#[from] library::list::Error), + #[error(transparent)] + Library_Flush(#[from] library::flush::Error), + #[error(transparent)] + Library_GetOperationResult(#[from] library::get_operation_result::Error), + #[error(transparent)] + Library_Get(#[from] library::get::Error), + #[error(transparent)] + Library_Create(#[from] library::create::Error), + #[error(transparent)] + Library_Delete(#[from] library::delete::Error), + #[error(transparent)] Notebook_GetNotebooksByWorkspace(#[from] notebook::get_notebooks_by_workspace::Error), #[error(transparent)] Notebook_GetNotebookSummaryByWorkSpace(#[from] notebook::get_notebook_summary_by_work_space::Error), @@ -3218,6 +3230,39 @@ pub mod library { x_ms_blob_condition_appendpos: None, } } + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + pub fn flush(&self, library_name: impl Into) -> flush::Builder { + flush::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } + pub fn get_operation_result(&self, operation_id: impl Into) -> get_operation_result::Builder { + get_operation_result::Builder { + client: self.0.clone(), + operation_id: operation_id.into(), + } + } + pub fn get(&self, library_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } + pub fn create(&self, library_name: impl Into) -> create::Builder { + create::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } + pub fn delete(&self, library_name: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } } pub mod append { use super::models; @@ -3296,6 +3341,455 @@ pub mod library { } } } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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!("{}/libraries", 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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LibraryListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod flush { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::LibraryResourceInfo), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}/flush", self.client.endpoint(), &self.library_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + 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::LibraryResourceInfo = + 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 get_operation_result { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::LibraryResource), + Accepted202(models::OperationResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + 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!("{}/libraryOperationResults/{}", self.client.endpoint(), &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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LibraryResource = + 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::OperationResult = + 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 get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotModified304 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}", self.client.endpoint(), &self.library_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LibraryResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_MODIFIED => Err(Error::NotModified304 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::LibraryResourceInfo), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}", self.client.endpoint(), &self.library_name); + let mut url = 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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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::LibraryResourceInfo = + 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; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::LibraryResourceInfo), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}", self.client.endpoint(), &self.library_name); + let mut url = 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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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::LibraryResourceInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + 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 notebook { use super::models; diff --git a/services/svc/synapse/src/package_artifacts_composite_v2/operations.rs b/services/svc/synapse/src/package_artifacts_composite_v2/operations.rs index 43b0989118..0f359df338 100644 --- a/services/svc/synapse/src/package_artifacts_composite_v2/operations.rs +++ b/services/svc/synapse/src/package_artifacts_composite_v2/operations.rs @@ -217,6 +217,18 @@ pub enum Error { #[error(transparent)] Library_Append(#[from] library::append::Error), #[error(transparent)] + Library_List(#[from] library::list::Error), + #[error(transparent)] + Library_Flush(#[from] library::flush::Error), + #[error(transparent)] + Library_GetOperationResult(#[from] library::get_operation_result::Error), + #[error(transparent)] + Library_Get(#[from] library::get::Error), + #[error(transparent)] + Library_Create(#[from] library::create::Error), + #[error(transparent)] + Library_Delete(#[from] library::delete::Error), + #[error(transparent)] Notebook_GetNotebooksByWorkspace(#[from] notebook::get_notebooks_by_workspace::Error), #[error(transparent)] Notebook_GetNotebookSummaryByWorkSpace(#[from] notebook::get_notebook_summary_by_work_space::Error), @@ -3218,6 +3230,39 @@ pub mod library { x_ms_blob_condition_appendpos: None, } } + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + pub fn flush(&self, library_name: impl Into) -> flush::Builder { + flush::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } + pub fn get_operation_result(&self, operation_id: impl Into) -> get_operation_result::Builder { + get_operation_result::Builder { + client: self.0.clone(), + operation_id: operation_id.into(), + } + } + pub fn get(&self, library_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } + pub fn create(&self, library_name: impl Into) -> create::Builder { + create::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } + pub fn delete(&self, library_name: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } } pub mod append { use super::models; @@ -3296,6 +3341,455 @@ pub mod library { } } } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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!("{}/libraries", 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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LibraryListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod flush { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::LibraryResourceInfo), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}/flush", self.client.endpoint(), &self.library_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + 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::LibraryResourceInfo = + 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 get_operation_result { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::LibraryResource), + Accepted202(models::OperationResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + 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!("{}/libraryOperationResults/{}", self.client.endpoint(), &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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LibraryResource = + 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::OperationResult = + 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 get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotModified304 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}", self.client.endpoint(), &self.library_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LibraryResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_MODIFIED => Err(Error::NotModified304 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::LibraryResourceInfo), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}", self.client.endpoint(), &self.library_name); + let mut url = 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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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::LibraryResourceInfo = + 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; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::LibraryResourceInfo), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}", self.client.endpoint(), &self.library_name); + let mut url = 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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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::LibraryResourceInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + 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 notebook { use super::models; diff --git a/services/svc/synapse/src/package_artifacts_composite_v3/operations.rs b/services/svc/synapse/src/package_artifacts_composite_v3/operations.rs index 5b5af3f4b3..18345d29b3 100644 --- a/services/svc/synapse/src/package_artifacts_composite_v3/operations.rs +++ b/services/svc/synapse/src/package_artifacts_composite_v3/operations.rs @@ -228,6 +228,18 @@ pub enum Error { #[error(transparent)] Library_Append(#[from] library::append::Error), #[error(transparent)] + Library_List(#[from] library::list::Error), + #[error(transparent)] + Library_Flush(#[from] library::flush::Error), + #[error(transparent)] + Library_GetOperationResult(#[from] library::get_operation_result::Error), + #[error(transparent)] + Library_Get(#[from] library::get::Error), + #[error(transparent)] + Library_Create(#[from] library::create::Error), + #[error(transparent)] + Library_Delete(#[from] library::delete::Error), + #[error(transparent)] Notebook_GetNotebooksByWorkspace(#[from] notebook::get_notebooks_by_workspace::Error), #[error(transparent)] Notebook_GetNotebookSummaryByWorkSpace(#[from] notebook::get_notebook_summary_by_work_space::Error), @@ -3540,6 +3552,39 @@ pub mod library { x_ms_blob_condition_appendpos: None, } } + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + pub fn flush(&self, library_name: impl Into) -> flush::Builder { + flush::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } + pub fn get_operation_result(&self, operation_id: impl Into) -> get_operation_result::Builder { + get_operation_result::Builder { + client: self.0.clone(), + operation_id: operation_id.into(), + } + } + pub fn get(&self, library_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } + pub fn create(&self, library_name: impl Into) -> create::Builder { + create::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } + pub fn delete(&self, library_name: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } } pub mod append { use super::models; @@ -3618,6 +3663,455 @@ pub mod library { } } } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] 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!("{}/libraries", 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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LibraryListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod flush { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::LibraryResourceInfo), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}/flush", self.client.endpoint(), &self.library_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + 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::LibraryResourceInfo = + 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 get_operation_result { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::LibraryResource), + Accepted202(models::OperationResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + 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!("{}/libraryOperationResults/{}", self.client.endpoint(), &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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LibraryResource = + 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::OperationResult = + 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 get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotModified304 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}", self.client.endpoint(), &self.library_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LibraryResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_MODIFIED => Err(Error::NotModified304 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_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; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::LibraryResourceInfo), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}", self.client.endpoint(), &self.library_name); + let mut url = 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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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::LibraryResourceInfo = + 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; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::LibraryResourceInfo), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[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")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}", self.client.endpoint(), &self.library_name); + let mut url = 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", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = 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::LibraryResourceInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + 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 notebook { use super::models;